]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2880: SIGSEGV after undo an arc deletion
authorazv <azv@opencascade.com>
Thu, 28 Feb 2019 09:51:35 +0000 (12:51 +0300)
committerazv <azv@opencascade.com>
Thu, 28 Feb 2019 09:51:35 +0000 (12:51 +0300)
Avoid crash while getting the position of tangency presentation.

src/SketcherPrs/SketcherPrs_PositionMgr.cpp

index 1670661528bda4efd13a656e7a4fc8535ab4d79f..d98ffa0ac766fa1dc54d7ddf7629e8c1a4c06b30 100644 (file)
@@ -150,14 +150,17 @@ const std::array<int, 2>& SketcherPrs_PositionMgr::getPositionIndex(GeomPointPtr
       if (aUseFeature) {
         DataPtr aData = aFeature->data();
         AttributeRefAttrPtr aObjRef = aData->refattr(SketchPlugin_Constraint::ENTITY_A());
-        FeaturePtr aObj = ModelAPI_Feature::feature(aObjRef->object());
+        FeaturePtr aObj;
+        if (aObjRef)
+          aObj = ModelAPI_Feature::feature(aObjRef->object());
         bool aContains = false;
-        if (containsPoint(aObj, aPnt2d, thePos)) {
+        if (aObj && containsPoint(aObj, aPnt2d, thePos)) {
           aContains = true;
         } else {
           aObjRef = aData->refattr(SketchPlugin_Constraint::ENTITY_B());
-          aObj = ModelAPI_Feature::feature(aObjRef->object());
-          if (containsPoint(aObj, aPnt2d, thePos)) {
+          if (aObjRef)
+            aObj = ModelAPI_Feature::feature(aObjRef->object());
+          if (aObj && containsPoint(aObj, aPnt2d, thePos)) {
             aContains = true;
           }
         }