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>
This commit is contained in:
Andy Shaw 2016-02-17 12:00:05 +01:00
parent cb6d751efa
commit bd43dcae8a

View File

@ -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;
}