Salome HOME
#878 Segmentation fault when setting distance on the two same points
authornds <nds@opencascade.com>
Mon, 7 Sep 2015 13:20:18 +0000 (16:20 +0300)
committernds <nds@opencascade.com>
Mon, 7 Sep 2015 13:20:47 +0000 (16:20 +0300)
Crash by click in the same point, caused by OCCT dir2d

src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp

index 6b1dd6bece6a3310ce855309214503d4fb86bdb9..7eeee42670cd1c92051ff22e969147ea675eb403 100644 (file)
@@ -277,6 +277,9 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID)
     } else
       return;
 
+    if (aEndPnt->distance(aStartPnt) < tolerance)
+      return;
+
     std::shared_ptr<GeomAPI_Dir2d> aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt)));
     std::shared_ptr<GeomAPI_XY> aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt);