From bd43dcae8a0761f265a4b1a10e34f301fc49f311 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 17 Feb 2016 12:00:05 +0100 Subject: 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 Reviewed-by: Allan Sandfeld Jensen --- src/gui/image/qimage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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; } -- cgit v1.2.3