From: vsv Date: Fri, 28 Sep 2018 06:55:06 +0000 (+0300) Subject: Issue #2504: Fix to avoid crashes on non-valid geometry X-Git-Tag: CEA_2018-2~60 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9271fd6f93a7680e65bb4addda0296eaa5e1f1a6;p=modules%2Fshaper.git Issue #2504: Fix to avoid crashes on non-valid geometry --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp index ee4d1ea1f..fb7d2e102 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Measurement.cpp @@ -318,6 +318,11 @@ void FeaturesPlugin_Measurement::computeAngleByPoints() AISObjectPtr FeaturesPlugin_Measurement::getAISObject(AISObjectPtr thePrevious) { + AttributeDoubleArrayPtr aValues = + std::dynamic_pointer_cast(attribute(RESULT_VALUES_ID())); + if ((aValues->size() == 0) || (aValues->value(0) <= Precision::Confusion())) + return thePrevious; + AISObjectPtr anAIS; std::string aKind = string(MEASURE_KIND())->value(); if (aKind == MEASURE_LENGTH()) @@ -522,6 +527,7 @@ AISObjectPtr FeaturesPlugin_Measurement::angleDimension(AISObjectPtr thePrevious if (anEdge1.get() && anEdge2.get()) { TopoDS_Edge aTEdge1 = TopoDS::Edge(anEdge1->impl()); TopoDS_Edge aTEdge2 = TopoDS::Edge(anEdge2->impl()); + Handle(AIS_AngleDimension) aDim; if (thePrevious.get()) { aAISObj = thePrevious; @@ -556,6 +562,11 @@ AISObjectPtr FeaturesPlugin_Measurement::angleByPointsDimension(AISObjectPtr the gp_Pnt aPnt2(aPoint2->impl()); gp_Pnt aPnt3(aPoint3->impl()); + if (aPnt1.IsEqual(aPnt2, Precision::Confusion()) || + aPnt1.IsEqual(aPnt3, Precision::Confusion()) || + aPnt2.IsEqual(aPnt3, Precision::Confusion())) + return thePrevious; + if (thePrevious.get()) { aAISObj = thePrevious; Handle(AIS_InteractiveObject) aAIS = aAISObj->impl();