Salome HOME
0021954: [CEA 706] Error at the mesh object creation
authoreap <eap@opencascade.com>
Thu, 8 Nov 2012 15:34:29 +0000 (15:34 +0000)
committereap <eap@opencascade.com>
Thu, 8 Nov 2012 15:34:29 +0000 (15:34 +0000)
   protect fillAncestorsMap() from empty compounds

src/SMESH/SMESH_Mesh.cxx

index 0b171a6efbb293fddecff2e4c8f44059ca114d11..57c618de1580e109a014abf4897c5f292d0fab99 100644 (file)
@@ -1999,7 +1999,9 @@ void SMESH_Mesh::fillAncestorsMap(const TopoDS_Shape& theShape)
   {
     // a geom group is added. Insert it into lists of ancestors before
     // the first ancestor more complex than group members
-    int memberType = TopoDS_Iterator( theShape ).Value().ShapeType();
+    TopoDS_Iterator subIt( theShape );
+    if ( !subIt.More() ) return;
+    int memberType = subIt.Value().ShapeType();
     for ( desType = TopAbs_VERTEX; desType >= memberType; desType-- )
       for (TopExp_Explorer des( theShape, TopAbs_ShapeEnum( desType )); des.More(); des.Next())
       {