summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@theqtcompany.com>2016-02-17 12:00:05 +0100
committerAndy Shaw <andy.shaw@theqtcompany.com>2016-03-01 10:12:33 +0000
commitbd43dcae8a0761f265a4b1a10e34f301fc49f311 (patch)
tree125e605b6cd4e7ec1ac3e9de6c29a98561041d65 /src/gui
parentcb6d751efa2199746cd3c19e6639f8c23891e283 (diff)
Only copy the data if the image is not null
If the image was unable to do the smooth scaling due to running out of memory then it will return a null QImage, so this should be checked before copying the data to prevent a crash. Change-Id: I82a6443ce2d701c45110b5dd3c5ed4813d078312 Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qimage.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 667b65431e..6f649efcf4 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4411,7 +4411,8 @@ QImage QImage::smoothScaled(int w, int h) const {
src = src.convertToFormat(QImage::Format_RGB32);
}
src = qSmoothScaleImage(src, w, h);
- copyMetadata(src.d, d);
+ if (!src.isNull())
+ copyMetadata(src.d, d);
return src;
}