From 8be772f47d667b67c7567de1143e5d5080b13391 Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Tue, 30 Jun 2020 14:02:16 +0300 Subject: [PATCH] Task #3230: Sketcher: create a curve passing through selected points or vertices of a polyline Fix crash on reordering the list of points. --- src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp index 2ec8797c6..4e229efc0 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_CurveBuilder.cpp @@ -186,6 +186,8 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list& thePoints) // remove duplicates std::list::iterator aRemoveIt = aNextIt++; thePoints.erase(aRemoveIt); + // update iterator showing the nearest point, because it may become invalid + aNearestIt = aPIt; ++aNearestIt; continue; } if (aDist < aMinDist && (aMinDist - aDist) > Precision::Confusion()) { -- 2.39.2