Salome HOME
Issue #2741: Undo of distance argument change produces crash
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintDistance.cpp
index 44daa41fa087f4bc2ca6f908497ea2bdb69a7be5..1f827a3c637b279b4b2ea6bfa56a99ea96897757 100644 (file)
@@ -167,8 +167,12 @@ void SketchSolver_ConstraintDistance::removeConstraintsKeepingSign()
   aParams.insert(myOddPoint->y);
   aStorage->removeParameters(aParams);
 
-  aGCSConstraints.pop_back();
-  aGCSConstraints.pop_back();
+  // remove constraints keeping sign of point-line distance,
+  // not more than 2 additional constraints is possible
+  if (!aGCSConstraints.empty())
+    aGCSConstraints.pop_back();
+  if (!aGCSConstraints.empty())
+    aGCSConstraints.pop_back();
   aConstraint->setConstraints(aGCSConstraints);
   aStorage->addConstraint(myBaseConstraint, aConstraint);