From: mpv Date: Fri, 16 May 2014 08:22:30 +0000 (+0400) Subject: Fixed crash on undo/redo X-Git-Tag: V_0.2~54^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7de691f1bce383a26cf4119d8ed87f421a09981b;p=modules%2Fshaper.git Fixed crash on undo/redo --- diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index daa53a1a6..16a86b194 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -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); } } diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 7618babe2..943992055 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -324,7 +324,8 @@ boost::shared_ptr 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(); // not found