diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-01 12:40:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-02 09:32:36 +0100 |
commit | 9f4098937be1325c12a224de18974352b14aee38 (patch) | |
tree | b6507217e6e24286313790c9300452eda7ad6ce6 /src/gui/image/qimage.cpp | |
parent | feb6711a7962c210a2c88f416200e266fb30597a (diff) |
Fix nullptr dereference on out-of-memory conditions
Fixes two static analysis warnings.
Change-Id: Id4644d1944e97c9c53d2268a9a71e5f6347d3946
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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++) { |