From 8e68ab77876153a04d8e53a9b11f30c2582418ae Mon Sep 17 00:00:00 2001 From: csmartdalton Date: Wed, 8 May 2024 21:55:43 +0000 Subject: [PATCH] Fix an assert in contour_measure.cpp Since fp32 has finite precision, a segment may reasonably become degenerate with length 0, and we need to be robust enough to handle this. Asserting that the distance is non-negative is still a good test. Fixes #7210. Diffs= 806ae1fae Fix an assert in contour_measure.cpp (#7232) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com> --- .rive_head | 2 +- src/math/contour_measure.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.rive_head b/.rive_head index 9faac266..42e70600 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -7d03c3fafeefd05513c4a418f320322ecd1c1e4e +806ae1faea4cc10452c76a4ce2b35f2ca12aa469 diff --git a/src/math/contour_measure.cpp b/src/math/contour_measure.cpp index 57c833c4..247f9082 100644 --- a/src/math/contour_measure.cpp +++ b/src/math/contour_measure.cpp @@ -34,7 +34,7 @@ ContourMeasure::ContourMeasure(std::vector&& segs, // or the last segment if distance == m_distance size_t ContourMeasure::findSegment(float distance) const { - assert(m_segments.front().m_distance > 0); + assert(m_segments.front().m_distance >= 0); assert(m_segments.back().m_distance == m_length); assert(distance >= 0 && distance <= m_length);