From: azv Date: Fri, 12 Jan 2018 11:50:22 +0000 (+0300) Subject: Avoid crash when creating presentation of the Tangency constraint. X-Git-Tag: V_3.0.0RC1~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3c46eaaf05cee455691f51a8555f1e7a9540bfdb;p=modules%2Fshaper.git Avoid crash when creating presentation of the Tangency constraint. --- 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));