Salome HOME
Dump with geometrical selection
[modules/shaper.git] / src / Model / Model_ResultBody.cpp
index e168c6c1a0f96cb09234afe9bc6fa4aeeb2848b5..c68a4ae4b54f2107f56759a0fa7c5bcfbc99ed29 100644 (file)
@@ -93,6 +93,8 @@ int Model_ResultBody::numberOfSubs(bool forTree) const
 
 ResultBodyPtr Model_ResultBody::subResult(const int theIndex, bool forTree) const
 {
+  if (theIndex >= int(mySubs.size()))
+    return ResultBodyPtr();
   return mySubs.at(theIndex);
 }
 
@@ -159,6 +161,8 @@ void Model_ResultBody::updateConcealment()
   if (myLastConcealed != ModelAPI_ResultBody::isConcealed()) {
     // check the whole tree of results: if one is concealed, everybody are concealed
     ResultBodyPtr anOwner = std::dynamic_pointer_cast<ModelAPI_ResultBody>(data()->owner());
+    if (!anOwner.get())
+      return; // "this" is invalid
     ResultBodyPtr aParent = ModelAPI_Tools::bodyOwner(anOwner);
     while(aParent.get()) {
       anOwner = aParent;