From: Holger Hans Peter Freyther Date: Mon, 23 Jan 2012 13:02:48 +0000 (+0100) Subject: pixmap: Add QPlatformPixmap::fromData null check for the image X-Git-Tag: qt-v5.0.0-alpha1~1396 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9cbbd38f22fe0aff72599583c7702f88195a7607;p=profile%2Fivi%2Fqtbase.git pixmap: Add QPlatformPixmap::fromData null check for the image QPlatformPixmap::fromFile is doing the null check, QRasterPlatformPixmap::fromData is doing the null check as well. Add the null check to QPlatformPixmap::fromData as well. This would have avoided a crash in the directfb plugin. Change-Id: Ifc904b2df2424e86bf0992d4e28dc256530be02d Reviewed-by: Samuel Rødal --- diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp index c34b779..5162ea8 100644 --- a/src/gui/image/qplatformpixmap.cpp +++ b/src/gui/image/qplatformpixmap.cpp @@ -133,6 +133,8 @@ bool QPlatformPixmap::fromData(const uchar *buf, uint len, const char *format, Q QBuffer b(&a); b.open(QIODevice::ReadOnly); QImage image = QImageReader(&b, format).read(); + if (image.isNull()) + return false; fromImage(makeBitmapCompliantIfNeeded(this, image, flags), flags); return !isNull(); }