[graphics/krita] libs/ui/tool: Avoid division by zero in ref image painting
Emmet O'Neill <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit b9a2d3fabcd3095abce44daabf658143bf23af50 by Emmet O'Neill, on behalf of Dat Le.
Committed on 13/08/2026 at 23:16.
Pushed by emmetoneill into branch 'master'.
Avoid division by zero in ref image painting
M +3 -0 libs/ui/tool/KisAsyncColorSamplerHelper.cpp
https://invent.kde.org/graphics/krita/-/commit/b9a2d3fabcd3095abce44daabf658143bf23af50
diff --git a/libs/ui/tool/KisAsyncColorSamplerHelper.cpp b/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
index 520d1fd608b..693f9af3dd9 100644
--- a/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
+++ b/libs/ui/tool/KisAsyncColorSamplerHelper.cpp
@@ -820,6 +820,9 @@ void KisAsyncColorSamplerHelper::paintCircleReferenceImagePreview(QPainter &gc,
qreal xScale = refImage->size().width() / image.width();
qreal yScale = refImage->size().height() / image.height();
+ // This only happens when refImage size is 0, so painting it probably won't make senses
+ if (xScale == 0 || yScale == 0) continue;
+
QRect refPixelRect = QRect(refPixelPoint, QSize(zoomDocRectF.width() / xScale, zoomDocRectF.height() / yScale));
refPixelRect = m_d->standardizeZoomPreviewPixelRect(refPixelRect);