summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_raster.cpp
diff options
context:
space:
mode:
authorMartin Pley <qt@pley.org>2014-06-10 13:33:26 +0200
committerMorten Johan Sørvig <morten.sorvig@digia.com>2014-06-16 14:29:13 +0200
commitc92ece451872942c81592d33be495baa96afc416 (patch)
treedc2223ccfc0d4c9f8a6c5140642a2ccf7b8dc683 /src/gui/image/qpixmap_raster.cpp
parent4038f21dd0799d319a8ee019735cbe109405a532 (diff)
QRasterPlatformPixmap::createPixmapForImage(): Avoid crash when QImage conversion failes
Added some checks to QRasterPlatformPixmap::createPixmapForImage() to avoid crashes when QImage::convertToFormat() returns a null image. Change-Id: I573505a1aff7931d9a2fb452d0a83ae93d8de7db Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/gui/image/qpixmap_raster.cpp')
-rw-r--r--src/gui/image/qpixmap_raster.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 1465fea8b9..d879a5cb61 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -363,10 +363,12 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
}
is_null = (w <= 0 || h <= 0);
- image.d->devicePixelRatio = sourceImage.devicePixelRatio();
+ if (image.d)
+ image.d->devicePixelRatio = sourceImage.devicePixelRatio();
//ensure the pixmap and the image resulting from toImage() have the same cacheKey();
setSerialNumber(image.cacheKey() >> 32);
- setDetachNumber(image.d->detach_no);
+ if (image.d)
+ setDetachNumber(image.d->detach_no);
}
QImage* QRasterPlatformPixmap::buffer()