Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_CurveBuilder.cpp
index fd98f26af2eecd4b42648f26731a98f911352535..c24b3bc810d09fdd8972a08a057499c7c07c4b18 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -172,7 +172,6 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list<GeomPointPtr>& thePoints)
     return;
   }
 
-  int aNbDup = 0;
   std::list<GeomPointPtr>::iterator aPIt = thePoints.begin();
   GeomPointPtr aPrevPnt = *aPIt;
   for (; aPIt != thePoints.end(); ++aPIt) {
@@ -186,6 +185,8 @@ void GeomAlgoAPI_CurveBuilder::reorderPoints(std::list<GeomPointPtr>& thePoints)
         // remove duplicates
         std::list<GeomPointPtr>::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()) {