Salome HOME
Fix for exception on deletion of a Part from PartSet when it is active
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintLength.cpp
index 949908b293f628672969fdd7e52a85d5b3204d34..ba18dae3e82b711fe03b25772d411ff0aaee6932 100644 (file)
@@ -93,7 +93,8 @@ bool SketchPlugin_ConstraintLength::compute(const std::string& theAttributeId)
 
   std::shared_ptr<GeomAPI_Lin2d> aLine = 
     std::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt()));
-  if (fabs(aFlyOutAttr->x()) < tolerance && fabs(aFlyOutAttr->y()) < tolerance) {
+  if (!aFlyOutAttr->isInitialized() || 
+      (fabs(aFlyOutAttr->x()) < tolerance && fabs(aFlyOutAttr->y()) < tolerance)) {
     double aDist = aPoint1->distance(aPoint2)/5.;
     std::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
     aFlyOutAttr->setValue(aFPnt);