Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Avoid division by 0 in IME decorations for text shape.

Wolthera van Hövell tot Westerflier0d001613b97c
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index 7081aa76a7..a217be7ecc 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -640,7 +640,7 @@ QPainterPath KoSvgTextShape::underlines(int pos, int anchor, KoSvgText::TextDeco
}
const qreal freetypePixelsToPt = (1.0 / 64.0) * (72. / qMin(d->xRes, d->yRes));
- const qreal width = qMax(qreal(strokeWidth/(end-(start+1)))*freetypePixelsToPt, minimum);
+ const qreal width = strokeWidth > 0 ? qMax(qreal(strokeWidth/qMax(0, end-(start+1)))*freetypePixelsToPt, minimum): minimum;
stroker.setWidth(thick? width*2: width);