Salome HOME
Issue #19207: planes of imported STEP not usable
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Sketch.cpp
index 692ac5d0ed2be3377aad617f6744f1ca75773a5d..3eb121b863a0ee67344eb58d4d425962e5d2edb8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020  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
@@ -443,7 +443,11 @@ std::shared_ptr<GeomAPI_Ax3> SketchPlugin_Sketch::plane(SketchPlugin_Sketch* the
   std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
       aData->attribute(SketchPlugin_Sketch::NORM_ID()));
 
-  return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
+  if (aNorm.get() && aNorm->isInitialized() && anOrigin.get() && anOrigin->isInitialized())
+    return std::shared_ptr<GeomAPI_Ax3>(
+      new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
+
+  return std::shared_ptr<GeomAPI_Ax3>();
 }
 
 bool SketchPlugin_Sketch::customAction(const std::string& theActionId)