Salome HOME
Issue #2980: Crash when change sketch plane
authorazv <azv@opencascade.com>
Tue, 20 Aug 2019 13:11:00 +0000 (16:11 +0300)
committerazv <azv@opencascade.com>
Tue, 20 Aug 2019 13:11:00 +0000 (16:11 +0300)
Avoid crash on Horizontal/Vertical constraint presentation while changing the sketch plane.

src/SketcherPrs/SketcherPrs_HVDirection.cpp

index 942bd909e82d5ee64ff52e8250742dcae3463f68..336f298b28b7305853dd04d79779435c143da702 100644 (file)
@@ -39,13 +39,14 @@ SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint
 }
 
 bool SketcherPrs_HVDirection::IsReadyToDisplay(ModelAPI_Feature* theConstraint,
-                                               const std::shared_ptr<GeomAPI_Ax3>&/* thePlane*/)
+                                               const std::shared_ptr<GeomAPI_Ax3>& thePlane)
 {
   bool aReadyToDisplay = false;
-  ObjectPtr aObj =
-    SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
-
-  aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL;
+  if (thePlane.get()) {
+    ObjectPtr aObj =
+        SketcherPrs_Tools::getResult(theConstraint, SketchPlugin_Constraint::ENTITY_A());
+    aReadyToDisplay = SketcherPrs_Tools::getShape(aObj).get() != NULL;
+  }
   return aReadyToDisplay;
 }