From 2ca47c465924c4f9967bbc3938b3f44ef9bf6f41 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 fd98f26af..ab6499bf8 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