Salome HOME
Merge branch 'BR_internationalization'
[modules/shaper.git] / src / Model / Model_Document.cpp
index ac473ce216f07c9a20872aaf4c0ce6c95f3627f7..0c40c27230db30754d8036b080f676fbbbf0cb2a 100755 (executable)
@@ -43,6 +43,7 @@
 #include <TNaming_SameShapeIterator.hxx>
 #include <TNaming_Iterator.hxx>
 #include <TNaming_NamedShape.hxx>
+#include <TNaming_Tool.hxx>
 #include <TopExp_Explorer.hxx>
 
 #include <climits>
@@ -1292,6 +1293,8 @@ static Handle(TNaming_NamedShape) searchForOriginalShape(TopoDS_Shape theShape,
   while(!theShape.IsNull()) { // searching for the very initial shape that produces this one
     TopoDS_Shape aShape = theShape;
     theShape.Nullify();
+    if (!TNaming_Tool::HasLabel(aMain, aShape)) // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists
+      break;
     for(TNaming_SameShapeIterator anIter(aShape, aMain); anIter.More(); anIter.Next()) {
       TDF_Label aNSLab = anIter.Label();
       Handle(TNaming_NamedShape) aNS;