From ecdaaaad4b49203ba113f2d5f1085879af6ad56d Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 7 Apr 2015 14:08:55 +0300 Subject: [PATCH] Avoid working with empty attributes in constraints of sketch solver --- src/SketchSolver/SketchSolver_Constraint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index 370bdce0d..b86ce1a28 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -282,7 +282,7 @@ Slvs_hEntity SketchSolver_Constraint::changeEntity(AttributeRefAttrPtr theAttrib Slvs_hEntity SketchSolver_Constraint::changeEntity(AttributePtr theEntity, int& theType) { Slvs_hEntity aResult = SLVS_E_UNKNOWN; - if (!isInitialized(theEntity)) + if (!theEntity || !isInitialized(theEntity)) return SLVS_E_UNKNOWN; // If the entity is already in the group, try to find it @@ -378,7 +378,7 @@ Slvs_hEntity SketchSolver_Constraint::changeEntity(AttributePtr theEntity, int& Slvs_hEntity SketchSolver_Constraint::changeEntity(FeaturePtr theEntity, int& theType) { Slvs_hEntity aResult = SLVS_E_UNKNOWN; - if (!theEntity->data() || !theEntity->data()->isValid()) + if (!theEntity || !theEntity->data() || !theEntity->data()->isValid()) return SLVS_E_UNKNOWN; // If the entity is already in the group, try to find it std::map::const_iterator anEntIter = myFeatureMap.find(theEntity); -- 2.39.2