From 9f4098937be1325c12a224de18974352b14aee38 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 1 Feb 2021 12:40:36 +0100 Subject: Fix nullptr dereference on out-of-memory conditions Fixes two static analysis warnings. Change-Id: Id4644d1944e97c9c53d2268a9a71e5f6347d3946 Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 8d8245525a..c3054bccfe 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3036,6 +3036,8 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const QIMAGE_SANITYCHECK_MEMORY(maskImage); maskImage.fill(0); uchar *s = maskImage.bits(); + if (!s) + return QImage(); if (depth() == 32) { for (int h = 0; h < d->height; h++) { -- cgit v1.2.3