Salome HOME
Switch to SSL mode for tests : Get rid off all SALOME_TEST_DRIVER reference
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Pipe.cpp
index c3a38788782385f5fa00772b093daaa95fefc2fb..fcddc9cee66aa337caee8b8c6e6afcf97e274871 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -274,7 +274,7 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBa
 
   // Store generated edges/faces.
   GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
-  GeomAPI_Shape::ShapeType aShapeTypeToExplode;
+  GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
 
   switch(aBaseShapeType) {
     case GeomAPI_Shape::VERTEX: {
@@ -302,7 +302,10 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBa
     }
     case GeomAPI_Shape::COMPOUND: {
       aShapeTypeToExplode = GeomAPI_Shape::COMPOUND;
+      break;
     }
+    default:
+      return; // unsupported type of shape
   }
 
   if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
@@ -344,7 +347,7 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
   {
     GeomShapePtr aBaseShape = *anIter;
     GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType();
-    GeomAPI_Shape::ShapeType aShapeTypeToExplode;
+    GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
     switch(aBaseShapeType) {
       case GeomAPI_Shape::VERTEX: {
         aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
@@ -357,14 +360,18 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
         ListOfShape aV1History, aV2History;
         thePipeAlgo->generated(aV1, aV1History);
         thePipeAlgo->generated(aV2, aV2History);
-        aResultBody->generated(aV1, aV1History.front());
-        aResultBody->generated(aV2, aV2History.front());
+        if (!aV1History.empty())
+          aResultBody->generated(aV1, aV1History.front());
+        if (!aV2History.empty())
+          aResultBody->generated(aV2, aV2History.front());
       }
       case GeomAPI_Shape::FACE:
       case GeomAPI_Shape::SHELL: {
         aShapeTypeToExplode = GeomAPI_Shape::EDGE;
         break;
       }
+      default:
+        return; // unsupported type of shape
     }
     aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode);
   }
@@ -412,6 +419,8 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody,
       aShapeTypeToExplore = GeomAPI_Shape::COMPOUND;
       break;
     }
+    default:
+      return; // unsupported type of shape
   }
 
   // Store shapes.