From: jfa Date: Thu, 14 Sep 2023 12:34:12 +0000 (+0100) Subject: Fix incorrect shape dump. Shape explorer returns the main shape in case if there... X-Git-Tag: V9_12_0a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d72659ced7d4046a5142b897f8f5c3652d61dbb9;p=modules%2Fshaper.git Fix incorrect shape dump. Shape explorer returns the main shape in case if there are no more sub-shapes. --- diff --git a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp index 97523e429..3804f7087 100644 --- a/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp +++ b/src/ModelHighAPI/ModelHighAPI_FeatureStore.cpp @@ -411,9 +411,12 @@ std::string ModelHighAPI_FeatureStore::dumpShape(std::shared_ptr& 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);