From 308c2699ff8e2849eeedaf5caba9f4b1c2b01805 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 6 Oct 2015 18:48:56 +0300 Subject: [PATCH] INT PAL 52904: TC 7.7.0: Save & Close operation leads to the segmentation violation --- src/SalomeApp/SalomeApp_Study.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 7575c3cad..3211ad20a 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -255,12 +255,13 @@ public: std::string::size_type debut = 0; std::string::size_type fin; SalomeApp_DataObject* anObj = dynamic_cast( myStudy->root() ); - while ( 1 ) { + while ( anObj ) { fin = obj_id.find_first_of( ':', debut ); if ( fin == std::string::npos ) { //last id anObj = dynamic_cast(anObj->childObject(atoi(obj_id.substr(debut).c_str())-1)); - entry2SuitObject[parent_id] = anObj; + if ( anObj ) + entry2SuitObject[parent_id] = anObj; break; } anID = root_id + obj_id.substr( 0, fin ); @@ -268,13 +269,15 @@ public: if ( it2 == entry2SuitObject.end() ) { //the ID is not known in entry2SuitObject anObj = dynamic_cast(anObj->childObject(atoi(obj_id.substr(debut, fin-debut).c_str())-1)); - entry2SuitObject[anID] = anObj; + if ( anObj ) + entry2SuitObject[anID] = anObj; } else anObj = it2->second; debut = fin+1; } - anObj->insertChildAtTag( suit_obj, tag ); + if ( anObj ) + anObj->insertChildAtTag( suit_obj, tag ); } } entry2SuitObject[theID] = suit_obj; -- 2.39.2