]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid working with empty attributes in constraints of sketch solver
authorazv <azv@opencascade.com>
Tue, 7 Apr 2015 11:08:55 +0000 (14:08 +0300)
committerazv <azv@opencascade.com>
Tue, 7 Apr 2015 11:08:55 +0000 (14:08 +0300)
src/SketchSolver/SketchSolver_Constraint.cpp

index 370bdce0d4e4962f6ac7f2d8635e077c91769383..b86ce1a28073d4caa0cecf85827bc7e4b4b517b8 100644 (file)
@@ -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<FeaturePtr, Slvs_hEntity>::const_iterator anEntIter = myFeatureMap.find(theEntity);