summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-11-16 09:42:35 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-11-16 09:43:49 (GMT)
commitdbaea6fa5a90742d89691685baa44a1a34598f21 (patch)
tree0b67b2d2fe5804d19adb5dc2f03de126b5d2efbe /src
parent2b60b542a5f51cb983e4ad99c5fdf4e962b59b89 (diff)
downloadQt-dbaea6fa5a90742d89691685baa44a1a34598f21.zip
Qt-dbaea6fa5a90742d89691685baa44a1a34598f21.tar.gz
Qt-dbaea6fa5a90742d89691685baa44a1a34598f21.tar.bz2
Fixed a crash in QPixmap::fromImage() when passing in a null image.
Task-number: QTBUG-5840 Reviewed-by: Kim
Diffstat (limited to 'src')
-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 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;