Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/modules/shaper
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeAPI.cpp
index 8b3539c267ef43e2cc1db01ab9431b46a18a556d..b0dabccc9cb1f3866c7ea8ae3773f29b8dc069d9 100644 (file)
@@ -78,7 +78,7 @@ namespace GeomAlgoAPI_ShapeAPI
     if (!theEdge) {
       throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid.");
     }
-    
+
     std::shared_ptr<GeomAPI_Ax2> anAxis;
     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
                                                           theEdge->line()->direction()));
@@ -105,6 +105,15 @@ namespace GeomAlgoAPI_ShapeAPI
     std::shared_ptr<GeomAPI_Pnt> theBasePoint, std::shared_ptr<GeomAPI_Edge> theEdge,
     double theRadius, double theHeight, double theAngle) throw (GeomAlgoAPI_Exception)
   {
+    // Check if the base point is OK
+    if (!theBasePoint) {
+      throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid.");
+    }
+    // Check if the edge is OK
+    if (!theEdge) {
+      throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid.");
+    }
+
     std::shared_ptr<GeomAPI_Ax2> anAxis;
     anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
                                                           theEdge->line()->direction()));