From 67eb8b88a5a9623cc0a8f4964b8eee388ca251dd Mon Sep 17 00:00:00 2001 From: dbv Date: Fri, 15 Apr 2016 13:24:55 +0300 Subject: [PATCH] Issue #1369: fix for wire base validator --- .../FeaturesPlugin_Validators.cpp | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index ed019bb64..c8559d011 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -343,7 +343,21 @@ bool FeaturesPlugin_ValidatorBaseForWire::isValid(const AttributePtr& theAttribu ListOfShape aListOfShapes; for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { AttributeSelectionPtr aSelection = aSelectionList->value(anIndex); + if(!aSelection.get()) { + theError = "Could not get selection."; + return false; + } + ResultPtr aContext = aSelection->context(); + if(!aContext.get()) { + theError = "Attribute have empty context."; + return false; + } + GeomShapePtr aShape = aSelection->value(); + GeomShapePtr aContextShape = aContext->shape(); + if(!aShape.get()) { + aShape = aContextShape; + } if(!aShape.get()) { theError = "Empty shape selected."; return false; @@ -356,14 +370,13 @@ bool FeaturesPlugin_ValidatorBaseForWire::isValid(const AttributePtr& theAttribu } // Check that it is edge on sketch. - ResultPtr aContext = aSelection->context(); - if(!aContext.get()) { - theError = "Attribute have empty context."; - return false; - } - GeomShapePtr aContextShape = aContext->shape(); ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aContext); if(aConstruction.get()) { + if(aConstruction->isInfinite()) { + theError = "Inifinte objects not acceptable."; + return false; + } + std::shared_ptr anEdges = std::dynamic_pointer_cast(aContextShape); if(!anEdges.get()) { // It is not an edge on the sketch. -- 2.39.2