X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModel%2FModel_AttributeReference.cpp;h=43bbabe658fff74259890026c982b1302d55670c;hb=e6655db718a3c9dad621d3990d9ff4c833ac1532;hp=e65cb91c2e2f6a32cf6537c128c3f62a430992f0;hpb=eb46781716082e5c57561426894fe4c0c989224e;p=modules%2Fshaper.git diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index e65cb91c2..43bbabe65 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: ModelAPI_AttributeReference.cxx // Created: 2 Apr 2014 // Author: Mikhail PONIKAROV @@ -30,8 +32,8 @@ void Model_AttributeReference::setValue(ObjectPtr theObject) std::dynamic_pointer_cast(owner()->document()); myRef->Set(anObjLab); // references to the object label // remove external link attributes (if any) - anObjLab.ForgetAttribute(TDataStd_Comment::GetID()); - anObjLab.ForgetAttribute(TDataStd_AsciiString::GetID()); + myRef->Label().ForgetAttribute(TDataStd_Comment::GetID()); + myRef->Label().ForgetAttribute(TDataStd_AsciiString::GetID()); } else { // different document: store the document name (comment) and entry (string): external // if these attributes exist, the link is external: keep reference to access the label TDataStd_Comment::Set(myRef->Label(), theObject->document()->id().c_str()); @@ -67,7 +69,9 @@ ObjectPtr Model_AttributeReference::value() owner()->document()); if (aDoc) { TDF_Label aRefLab = myRef->Get(); - return aDoc->object(aRefLab); + if (!aRefLab.IsNull()) { // it may happen with old document, issue #285 + return aDoc->object(aRefLab); + } } } }