From de7e12e9101b8c3b07ade2ac9f479326b5c33825 Mon Sep 17 00:00:00 2001 From: Joshua Rogers Date: Mon, 21 Jul 2025 16:53:32 +0200 Subject: [PATCH] chore: ensure dashes are at least zero length when using fmodf --- src/shapes/paint/dash.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/shapes/paint/dash.cpp b/src/shapes/paint/dash.cpp index de06f39eb..3534bf369 100644 --- a/src/shapes/paint/dash.cpp +++ b/src/shapes/paint/dash.cpp @@ -14,6 +14,11 @@ Dash::Dash(float value, bool percentage) float Dash::normalizedLength(float contourLength) const { float right = lengthIsPercentage() ? 1.0f : contourLength; + if (right == 0.0f) + { + return 0.0f; + } + float p = fmodf(length(), right); if (p < 0.0f) { @@ -41,4 +46,4 @@ void Dash::lengthChanged() parent()->as()->invalidateDash(); } -void Dash::lengthIsPercentageChanged() { lengthChanged(); } \ No newline at end of file +void Dash::lengthIsPercentageChanged() { lengthChanged(); }