From 308ca9c702c3ff3e701489fcddbcb800bcf889d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 6 Dec 2021 22:58:49 +0100 Subject: [PATCH] Added missing image validity check (invalid images cause a divide-by-zero error later in the code) --- src/map/textpointitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map/textpointitem.cpp b/src/map/textpointitem.cpp index 7c6b70d2..f7888e98 100644 --- a/src/map/textpointitem.cpp +++ b/src/map/textpointitem.cpp @@ -40,7 +40,7 @@ void TextPointItem::setPos(const QPoint &point, bool padding) QPainterPath shape; QRect iconRect; - if (_img) { + if (_img && !_img->isNull()) { QSize s(_img->size() / _img->devicePixelRatioF()); int xOffset = padding ? s.width() : s.width() / 2; iconRect = QRect(QPoint(point.x() - xOffset, point.y() @@ -57,7 +57,7 @@ void TextPointItem::setPos(const QPoint &point, bool padding) void TextPointItem::paint(QPainter *painter) const { - if (_img) { + if (_img && !_img->isNull()) { QSize s(_img->size() / _img->devicePixelRatioF()); painter->drawImage(QPoint(_rect.left(), _rect.center().y() - s.height()/2), *_img);