1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-06 18:26:22 +03:00

0024280: Documentation of TObj_Model::GetFile() is incorrect

Do not throw exception when model was not stored yet
This commit is contained in:
kgv 2013-10-25 09:17:26 +04:00 committed by bugmaster
parent 9f6931fb8a
commit 06c13a57cf

View File

@ -224,13 +224,17 @@ Standard_Boolean TObj_Model::Load (const char* theFile)
Handle(TCollection_HAsciiString) TObj_Model::GetFile() const Handle(TCollection_HAsciiString) TObj_Model::GetFile() const
{ {
Handle(TDocStd_Document) aDoc = TDocStd_Document::Get(GetLabel()); Handle(TDocStd_Document) aDoc = GetDocument();
if ( !aDoc.IsNull() ) { if ( aDoc.IsNull()
TCollection_AsciiString anOldPath( aDoc->GetPath() ); || !aDoc->IsStored())
if ( !anOldPath.IsEmpty() ) {
return new TCollection_HAsciiString( anOldPath ); return Handle(TCollection_HAsciiString)();
} }
return 0;
TCollection_AsciiString aPath (aDoc->GetPath());
return !aPath.IsEmpty()
? new TCollection_HAsciiString (aPath)
: Handle(TCollection_HAsciiString)();
} }
//======================================================================= //=======================================================================