From: azv Date: Fri, 25 Feb 2022 05:28:15 +0000 (+0300) Subject: bos #24513 Dealing with conflicting constraints X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR24513;p=modules%2Fshaper.git bos #24513 Dealing with conflicting constraints Fix crash on processing overconstrained situation after H/V constraint --- diff --git a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp index 08afd7b2b..e54da2688 100644 --- a/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp +++ b/src/SketchPlugin/SketchPlugin_OverConstraintsResolver.cpp @@ -69,7 +69,7 @@ bool SketchPlugin_OverConstraintsResolver::checkHorizontalOrVerticalConflict() if (aFeature) { std::string aType = aFeature->getKind(); if ((aType == SketchPlugin_ConstraintHorizontal::ID()) || - (aType == SketchPlugin_ConstraintVertical::ID())) + (aType == SketchPlugin_ConstraintVertical::ID())) { myConstraintsToRemove.insert(*anIt); isHVConstraint = true; @@ -95,6 +95,8 @@ bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() aConstain->ENTITY_A()); std::shared_ptr aRefAttrB = aConstain->refattr( aConstain->ENTITY_B()); + if (!aRefAttrA || !aRefAttrB) + continue; FeaturePtr aFeatureA = ModelAPI_Feature::feature(aRefAttrA->object()); FeaturePtr aFeatureB = ModelAPI_Feature::feature(aRefAttrB->object()); @@ -130,7 +132,7 @@ bool SketchPlugin_OverConstraintsResolver::checkArcsAboutTangentialConflict() for (auto aFeatIter = aFeaturesA.begin(); aFeatIter != aFeaturesA.end(); ++aFeatIter) { if (aFeaturesB.find(aFeatIter.operator*()) != aFeaturesB.end()){ - std::string aType = (*aFeatIter)->getKind(); + const std::string& aType = (*aFeatIter)->getKind(); if (aType == SketchPlugin_ConstraintCoincidence::ID()) { ConstraintPtr aCoincidence = std::dynamic_pointer_cast(*aFeatIter);