From 3c46eaaf05cee455691f51a8555f1e7a9540bfdb Mon Sep 17 00:00:00 2001 From: azv Date: Fri, 12 Jan 2018 14:50:22 +0300 Subject: [PATCH] Avoid crash when creating presentation of the Tangency constraint. --- src/SketcherPrs/SketcherPrs_PositionMgr.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp index 00faae45d..85aa05217 100644 --- a/src/SketcherPrs/SketcherPrs_PositionMgr.cpp +++ b/src/SketcherPrs/SketcherPrs_PositionMgr.cpp @@ -300,7 +300,8 @@ std::list getCurves(const GeomPointPtr& thePnt, const SketcherPrs_Sym GeomPnt2dPtr aPnt1 = aSPnt1->pnt(); GeomPnt2dPtr aPnt2 = aSPnt2->pnt(); - if (aPnt1->isEqual(aPnt2d) || aPnt2->isEqual(aPnt2d)) { + if (aPnt1->distance(aPnt2d) <= Precision::Confusion() || + aPnt2->distance(aPnt2d) <= Precision::Confusion()) { // a point corresponds to one of the line end GeomShapePtr aShp = SketcherPrs_Tools::getShape(aFeature->firstResult()); GeomCurvePtr aCurv = std::shared_ptr(new GeomAPI_Curve(aShp)); @@ -394,7 +395,7 @@ gp_Pnt SketcherPrs_PositionMgr::getPointPosition( gp_Vec aVecPos; // If number of angle less then number of symbols then each symbol can be placed // directly inside of the angle - if (aAngles.size() >= aPos[1]) { + if (aAngles.size() >= aPos[1] && !aVectors.empty()) { int aId = aPos[0]; aVecPos = *(std::next(aVectors.begin(), aId)); -- 2.39.2