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 <samuel.rodal@nokia.com>
bb10
Holger Hans Peter Freyther 2012-01-23 14:02:48 +01:00 committed by Qt by Nokia
parent bd8ef8d073
commit 9cbbd38f22
1 changed files with 2 additions and 0 deletions

View File

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