From: kgv Date: Fri, 25 Oct 2013 05:17:26 +0000 (+0400) Subject: 0024280: Documentation of TObj_Model::GetFile() is incorrect X-Git-Tag: V6_7_0_beta~30 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=06c13a57cf9fc247bf36a088578c471cfd1f6bdc 0024280: Documentation of TObj_Model::GetFile() is incorrect Do not throw exception when model was not stored yet --- diff --git a/src/TObj/TObj_Model.cxx b/src/TObj/TObj_Model.cxx index 998a397c7d..82e194b8f6 100755 --- a/src/TObj/TObj_Model.cxx +++ b/src/TObj/TObj_Model.cxx @@ -224,13 +224,17 @@ Standard_Boolean TObj_Model::Load (const char* theFile) Handle(TCollection_HAsciiString) TObj_Model::GetFile() const { - Handle(TDocStd_Document) aDoc = TDocStd_Document::Get(GetLabel()); - if ( !aDoc.IsNull() ) { - TCollection_AsciiString anOldPath( aDoc->GetPath() ); - if ( !anOldPath.IsEmpty() ) - return new TCollection_HAsciiString( anOldPath ); + Handle(TDocStd_Document) aDoc = GetDocument(); + if ( aDoc.IsNull() + || !aDoc->IsStored()) + { + return Handle(TCollection_HAsciiString)(); } - return 0; + + TCollection_AsciiString aPath (aDoc->GetPath()); + return !aPath.IsEmpty() + ? new TCollection_HAsciiString (aPath) + : Handle(TCollection_HAsciiString)(); } //=======================================================================