From: adv Date: Fri, 17 Jan 2014 07:03:29 +0000 (+0000) Subject: Protection from crash. X-Git-Tag: BR_hydro_v_1_0~72 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb4b7993df5270eb77bf5b6b133eb01b950608d4;p=modules%2Fhydro.git Protection from crash. --- diff --git a/src/HYDROData/HYDROData_Obstacle.cxx b/src/HYDROData/HYDROData_Obstacle.cxx index 2b8c7cb6..22fcb0f5 100644 --- a/src/HYDROData/HYDROData_Obstacle.cxx +++ b/src/HYDROData/HYDROData_Obstacle.cxx @@ -143,9 +143,13 @@ QString HYDROData_Obstacle::GetFilePath() const { QString aRes; - Handle(TDataStd_AsciiString) anAsciiStr; - if ( myLab.FindChild( DataTag_FilePath ).FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) - aRes = QString( anAsciiStr->Get().ToCString() ); + TDF_Label aLabel = myLab.FindChild( DataTag_FilePath, false ); + if ( !aLabel.IsNull() ) + { + Handle(TDataStd_AsciiString) anAsciiStr; + if ( aLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) + aRes = QString( anAsciiStr->Get().ToCString() ); + } return aRes; } @@ -160,9 +164,13 @@ QString HYDROData_Obstacle::GetGeomObjectEntry() const { QString aRes; - Handle(TDataStd_AsciiString) anAsciiStr; - if ( myLab.FindChild( DataTag_GeomObjectEntry ).FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) - aRes = QString( anAsciiStr->Get().ToCString() ); + TDF_Label aLabel = myLab.FindChild( DataTag_GeomObjectEntry, false ); + if ( !aLabel.IsNull() ) + { + Handle(TDataStd_AsciiString) anAsciiStr; + if ( aLabel.FindAttribute( TDataStd_AsciiString::GetID(), anAsciiStr ) ) + aRes = QString( anAsciiStr->Get().ToCString() ); + } return aRes; }