From: dbv Date: Fri, 15 Apr 2016 10:24:55 +0000 (+0300) Subject: Issue #1369: fix for wire base validator X-Git-Tag: V_2.3.0~209 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=67eb8b88a5a9623cc0a8f4964b8eee388ca251dd;p=modules%2Fshaper.git Issue #1369: fix for wire base validator --- 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.