From: nds Date: Wed, 28 Jan 2015 11:38:54 +0000 (+0300) Subject: Issue #222 Fatal error for 0 distance X-Git-Tag: V_1.0.0~15^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=34a89e2ff091dbdd3ac59d6110a0dfba492e430b;p=modules%2Fshaper.git Issue #222 Fatal error for 0 distance The point on the circle line should not use this circle as an object in the distance operation. There was additional crash by selecting it. --- diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index b53102af2..29bdf3c27 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -22,16 +22,18 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature, SessionPtr aMgr = ModelAPI_Session::get(); ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - // If the object is not a line then it is accepted - const ModelAPI_ResultValidator* aLineValidator = - dynamic_cast(aFactory->validator("SketchPlugin_ResultLine")); - bool aLineValid = aLineValidator->isValid(theObject); - const ModelAPI_ResultValidator* anArcValidator = dynamic_cast(aFactory->validator("SketchPlugin_ResultArc")); bool anArcValid = anArcValidator->isValid(theObject); + if (anArcValid) + return false; - if (!aLineValid && !anArcValid) + + // If the object is not a line then it is accepted + const ModelAPI_ResultValidator* aLineValidator = + dynamic_cast(aFactory->validator("SketchPlugin_ResultLine")); + bool aLineValid = aLineValidator->isValid(theObject); + if (!aLineValid) return true; // If it is a line then we have to check that first attribute id not a line