]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fixed crash on undo/redo
authormpv <mikhail.ponikarov@opencascade.com>
Fri, 16 May 2014 08:22:30 +0000 (12:22 +0400)
committermpv <mikhail.ponikarov@opencascade.com>
Fri, 16 May 2014 08:22:30 +0000 (12:22 +0400)
src/Model/Model_AttributeRefAttr.cpp
src/Model/Model_Document.cpp

index daa53a1a6075b5aaa9a558e32087c88bf23df557..16a86b194f412b4f8e83f927aae7dcbdf3b77afe 100644 (file)
@@ -80,5 +80,7 @@ Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)
     // create attribute: not initialized by value yet
     myID = TDataStd_Comment::Set(theLabel, "");
     myRef = TDF_Reference::Set(theLabel, theLabel); // not initialized: reference to itself
+  } else {
+    theLabel.FindAttribute(TDF_Reference::GetID(), myRef);
   }
 }
index 7618babe23c484dab3d700d19fe30d6b3dc6856b..943992055a274818587808ac2ff7e0542ceb6c50 100644 (file)
@@ -324,7 +324,8 @@ boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
     Handle(TDataStd_Comment) aGroupID;
     if (theLabel.Father().FindAttribute(TDataStd_Comment::GetID(), aGroupID)) {
       string aGroup = TCollection_AsciiString(aGroupID->Get()).ToCString();
-      return myFeatures[aGroup][aFeatureIndex->Get()];
+      if (myFeatures[aGroup].size() > aFeatureIndex->Get())
+        return myFeatures[aGroup][aFeatureIndex->Get()];
     }
   }
   return boost::shared_ptr<ModelAPI_Feature>(); // not found