From aabe2d6cda9a24be85fa88146c6bb2b81bafd29e Mon Sep 17 00:00:00 2001 From: azv Date: Mon, 31 Oct 2016 10:34:54 +0300 Subject: [PATCH] Fix crash when removing point under Middle and Coincidence constraints (issues #1762, #1769) --- src/SketchSolver/SketchSolver_ConstraintMiddle.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- 2.39.2