Salome HOME
Merge remote-tracking branch 'remotes/origin/cgt/NormalToFace' into master
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Scale.cpp
index bde61cc26e94a1f596d93eae37f6dbc30c1c001c..776ef1960107ce9eee389b6e3510f1fa84a2ff2f 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
@@ -28,6 +28,10 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceSha
                                      std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
                                      double theScaleFactor)
 {
+  if (!theCenterPoint) {
+    myError = "Scale builder :: center point is not valid.";
+    return;
+  }
   if (fabs(theScaleFactor) < Precision::Confusion()) {
     myError = "Scale builder :: the scale factor is null.";
     return;
@@ -46,6 +50,10 @@ GeomAlgoAPI_Scale::GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceSha
                                      double theScaleFactorY,
                                      double theScaleFactorZ)
 {
+  if (!theCenterPoint) {
+    myError = "Scale builder :: center point is not valid.";
+    return;
+  }
   if (fabs(theScaleFactorX) < Precision::Confusion()) {
     myError = "Scale builder :: the scale factor in X is null.";
     return;
@@ -70,6 +78,11 @@ void GeomAlgoAPI_Scale::buildByDimensions(std::shared_ptr<GeomAPI_Shape> theSour
                                           double                         theScaleFactorY,
                                           double                         theScaleFactorZ)
 {
+  if (!theSourceShape) {
+    myError = "Scale builder :: source shape is not valid.";
+    return;
+  }
+
   const gp_Pnt& aCenterPoint = theCenterPoint->impl<gp_Pnt>();
 
   // Perform the rotation matrix