From: azv Date: Mon, 31 Oct 2016 07:34:54 +0000 (+0300) Subject: Fix crash when removing point under Middle and Coincidence constraints (issues #1762... X-Git-Tag: V_2.6.0~140 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aabe2d6cda9a24be85fa88146c6bb2b81bafd29e;p=modules%2Fshaper.git Fix crash when removing point under Middle and Coincidence constraints (issues #1762, #1769) --- diff --git a/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp b/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp index 545fa4687..362bc58cc 100644 --- a/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintMiddle.cpp @@ -32,6 +32,12 @@ void SketchSolver_ConstraintMiddle::notifyCoincidenceChanged( for (int i = 0; i < 2 && isSameAttr; ++i) { AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast( 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);