Salome HOME
Fix incorrect shape dump. Shape explorer returns the main shape in case if there...
authorjfa <jfa@opencascade.com>
Thu, 14 Sep 2023 12:34:12 +0000 (13:34 +0100)
committerjfa <jfa@opencascade.com>
Thu, 14 Sep 2023 12:34:12 +0000 (13:34 +0100)
src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp

index 97523e429ee19d62ca0159376a03c8773cc9d0b9..3804f70878d78df4045112dec1fa988bf5528503 100644 (file)
@@ -411,9 +411,12 @@ std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr<GeomAPI_Shape>&
   GeomAPI_Shape::ShapeType aType = GeomAPI_Shape::COMPOUND;
   for (; aType <= GeomAPI_Shape::VERTEX; aType = GeomAPI_Shape::ShapeType((int)aType + 1)) {
     GeomAPI_ShapeExplorer anExp(theShape, aType);
-    int aCount = 0;
-    for (; anExp.more(); anExp.next()) aCount++;
-    aResult << anExp.current()->shapeTypeStr().c_str() <<  ": " << aCount << std::endl;
+    if (anExp.more()) {
+      std::string aTypeStr = anExp.current()->shapeTypeStr();
+      int aCount = 0;
+      for (; anExp.more(); anExp.next()) aCount++;
+      aResult << aTypeStr.c_str() <<  ": " << aCount << std::endl;
+    }
   }
   // output the main characteristics
   double aVolume = GeomAlgoAPI_ShapeTools::volume(theShape);