From 22ebc746f0debea67e35b099a309836d7d67c315 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Fri, 22 Aug 2014 18:30:57 -0700 Subject: [PATCH] QImage creations fails causing QPainter to fail Need to check for QImage failure otherwise it will through a qWarning. --- .../src/mapwidget/mapgraphicitem.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp index de7d357213..ff5eba2305 100644 --- a/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ b/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp @@ -133,13 +133,15 @@ namespace mapcontrol temp=QImage(size, QImage::Format_ARGB32_Premultiplied); temp.fill(0); - QPainter imagePainter(&temp); - imagePainter.translate(-boundingRect().topLeft()); - imagePainter.scale(2*zoomdiff,2*zoomdiff); - paintImage(&imagePainter); - imagePainter.end(); - lastimagepoint=Point(core->GetrenderOffset().X()*2*zoomdiff,core->GetrenderOffset().Y()*2*zoomdiff); - lastimage=temp; + if (!temp.isNull()) { + QPainter imagePainter(&temp); + imagePainter.translate(-boundingRect().topLeft()); + imagePainter.scale(2*zoomdiff,2*zoomdiff); + paintImage(&imagePainter); + imagePainter.end(); + lastimagepoint=Point(core->GetrenderOffset().X()*2*zoomdiff,core->GetrenderOffset().Y()*2*zoomdiff); + lastimage=temp; + } } void MapGraphicItem::paintImage(QPainter *painter) { -- GitLab