Salome HOME
Avoid of reference to not-initialized attributes values
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Tools.cpp
index 84d0878f66df2d68817c3f3f12620e322a5bd50b..b8e37cc53219fad4b3248a423e77942ea8077958 100644 (file)
@@ -246,7 +246,9 @@ double getFlyoutDistance(const ModelAPI_Feature* theConstraint)
   std::shared_ptr<GeomDataAPI_Point2D> aFlyoutPoint =
       std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
       const_cast<ModelAPI_Feature*>(theConstraint)->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
-
+  // for not initialized values return zero distance to avoid Presentation crash
+  if (!aFlyoutPoint->isInitialized())
+    return 0;
   return aFlyoutPoint->y();
 }