Fix nullptr dereference on out-of-memory conditions

Fixes two static analysis warnings.

Change-Id: Id4644d1944e97c9c53d2268a9a71e5f6347d3946
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2021-02-01 12:40:36 +01:00
parent feb6711a79
commit 9f4098937b

View File

@ -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++) {