From 06c13a57cf9fc247bf36a088578c471cfd1f6bdc Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 25 Oct 2013 09:17:26 +0400 Subject: [PATCH] 0024280: Documentation of TObj_Model::GetFile() is incorrect Do not throw exception when model was not stored yet --- src/TObj/TObj_Model.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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)(); } //=======================================================================