summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpixmap_x11.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-11-16 10:42:35 +0100
committerTrond Kjernåsen <trond@trolltech.com>2009-11-16 10:43:49 +0100
commitdbaea6fa5a90742d89691685baa44a1a34598f21 (patch)
tree0b67b2d2fe5804d19adb5dc2f03de126b5d2efbe /src/gui/image/qpixmap_x11.cpp
parent2b60b542a5f51cb983e4ad99c5fdf4e962b59b89 (diff)
Fixed a crash in QPixmap::fromImage() when passing in a null image.
Task-number: QTBUG-5840 Reviewed-by: Kim
Diffstat (limited to 'src/gui/image/qpixmap_x11.cpp')
-rw-r--r--src/gui/image/qpixmap_x11.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 3f297dfef2..7008fbd4a1 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;