From dbaea6fa5a90742d89691685baa44a1a34598f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 16 Nov 2009 10:42:35 +0100 Subject: Fixed a crash in QPixmap::fromImage() when passing in a null image. Task-number: QTBUG-5840 Reviewed-by: Kim --- src/gui/image/qpixmap_x11.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 3f297df..7008fbd 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -416,6 +416,11 @@ void QX11PixmapData::fromImage(const QImage &img, d = img.depth(); is_null = (w <= 0 || h <= 0); + if (is_null) { + w = h = 0; + return; + } + if (defaultScreen >= 0 && defaultScreen != xinfo.screen()) { QX11InfoData* xd = xinfo.getX11Data(true); xd->screen = defaultScreen; -- cgit v0.12