Salome HOME
Using test for testing number of sub-shapes.
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMiddle.cpp
index 545fa468716157c323ccdbf7cbc92b6762b6666b..69de3881e0c751381c97375320a71c41c38ac9f2 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
 #include <SketchSolver_ConstraintMiddle.h>
 
 #include <SketchSolver_Builder.h>
@@ -32,6 +34,12 @@ void SketchSolver_ConstraintMiddle::notifyCoincidenceChanged(
   for (int i = 0; i < 2 && isSameAttr; ++i) {
     AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
         myBaseConstraint->attribute(SketchPlugin_Constraint::ATTRIBUTE(i)));
+    if (!aRefAttr)
+    {
+      // It seems the Middle point constraint has been deleted, so keep it unchanged.
+      // It will be removed later.
+      return;
+    }
     if (aRefAttr->isObject()) {
       FeaturePtr aFeature = ModelAPI_Feature::feature(aRefAttr->object());
       isSameAttr = (aFeature == aLine);