From 34a89e2ff091dbdd3ac59d6110a0dfba492e430b Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 28 Jan 2015 14:38:54 +0300 Subject: [PATCH] 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. --- src/SketchPlugin/SketchPlugin_Validators.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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 -- 2.39.2