Salome HOME
Update copyrights
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Validators.cpp
index 7e0b51b932dbd5df8410c652c98c671716c5ba5d..cb18ffafa06fc05c4e9513b46746be3c8ce2b34f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "FeaturesPlugin_Validators.h"
@@ -1117,14 +1116,10 @@ bool FeaturesPlugin_ValidatorUnionArguments::isValid(
 
   // Make compound and find connected.
   GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseShapesList);
-  ListOfShape aCombined, aFree;
-  GeomAlgoAPI_ShapeTools::combineShapes(
-    aCompound,
-    aType,
-    aCombined,
-    aFree);
-
-  if(aFree.size() > 0 || aCombined.size() > 1) {
+  ListOfShape aResults;
+  GeomAlgoAPI_ShapeTools::combineShapes(aCompound, aType, aResults);
+
+  if(aResults.size() > 1 || (aResults.size() == 1 && aResults.front()->shapeType() > aType)) {
     theError = "Error: Not all shapes have shared topology.";
     return false;
   }
@@ -1345,9 +1340,12 @@ bool FeaturesPlugin_ValidatorBooleanSmashSelection::isValid(
 
     ResultPtr aContext = anAttrSelection->context();
     std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
-    GeomShapePtr aContextShape = aContext->shape();
     if (!aShape.get()) {
-      aShape = aContextShape;
+      if (!aContext.get()) {
+        theError = "Error: Empty selection.";
+        return false;
+      }
+      aShape = aContext->shape();
     }
 
     if (aShape->isSolid() || aShape->isCompSolid()) {