diff --git a/src/Mod/Part/App/FeaturePartBoolean.cpp b/src/Mod/Part/App/FeaturePartBoolean.cpp index 0d63d309c1..cab2d1b32f 100644 --- a/src/Mod/Part/App/FeaturePartBoolean.cpp +++ b/src/Mod/Part/App/FeaturePartBoolean.cpp @@ -73,7 +73,11 @@ App::DocumentObjectExecReturn *Boolean::execute(void) // Now, let's get the TopoDS_Shape TopoDS_Shape BaseShape = base->Shape.getValue(); + if (BaseShape.IsNull()) + throw Base::Exception("Base shape is null"); TopoDS_Shape ToolShape = tool->Shape.getValue(); + if (ToolShape.IsNull()) + throw Base::Exception("Tool shape is null"); std::auto_ptr mkBool(makeOperation(BaseShape, ToolShape)); if (!mkBool->IsDone()) { @@ -81,7 +85,7 @@ App::DocumentObjectExecReturn *Boolean::execute(void) } TopoDS_Shape resShape = mkBool->Shape(); if (resShape.IsNull()) { - return new App::DocumentObjectExecReturn("Resulting shape is invalid"); + return new App::DocumentObjectExecReturn("Resulting shape is null"); } Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); diff --git a/src/Mod/Part/App/FeaturePartFuse.cpp b/src/Mod/Part/App/FeaturePartFuse.cpp index 9444524c3f..ffa7db2881 100644 --- a/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/src/Mod/Part/App/FeaturePartFuse.cpp @@ -87,7 +87,12 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void) try { std::vector history; TopoDS_Shape resShape = s.front(); + if (resShape.IsNull()) + throw Base::Exception("Input shape is null"); for (std::vector::iterator it = s.begin()+1; it != s.end(); ++it) { + if (it->IsNull()) + throw Base::Exception("Input shape is null"); + // Let's call algorithm computing a fuse operation: BRepAlgoAPI_Fuse mkFuse(resShape, *it); // Let's check if the fusion has been successful @@ -108,7 +113,7 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void) } } if (resShape.IsNull()) - throw Base::Exception("Resulting shape is invalid"); + throw Base::Exception("Resulting shape is null"); Base::Reference hGrp = App::GetApplication().GetUserParameter() .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part/Boolean"); diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index dc577d5717..81bc104d93 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -1278,30 +1278,50 @@ bool TopoShape::isClosed() const TopoDS_Shape TopoShape::cut(TopoDS_Shape shape) const { + if (this->_Shape.IsNull()) + Standard_Failure::Raise("Base shape is null"); + if (shape.IsNull()) + Standard_Failure::Raise("Tool shape is null"); BRepAlgoAPI_Cut mkCut(this->_Shape, shape); return mkCut.Shape(); } TopoDS_Shape TopoShape::common(TopoDS_Shape shape) const { + if (this->_Shape.IsNull()) + Standard_Failure::Raise("Base shape is null"); + if (shape.IsNull()) + Standard_Failure::Raise("Tool shape is null"); BRepAlgoAPI_Common mkCommon(this->_Shape, shape); return mkCommon.Shape(); } TopoDS_Shape TopoShape::fuse(TopoDS_Shape shape) const { + if (this->_Shape.IsNull()) + Standard_Failure::Raise("Base shape is null"); + if (shape.IsNull()) + Standard_Failure::Raise("Tool shape is null"); BRepAlgoAPI_Fuse mkFuse(this->_Shape, shape); return mkFuse.Shape(); } TopoDS_Shape TopoShape::oldFuse(TopoDS_Shape shape) const { + if (this->_Shape.IsNull()) + Standard_Failure::Raise("Base shape is null"); + if (shape.IsNull()) + Standard_Failure::Raise("Tool shape is null"); BRepAlgo_Fuse mkFuse(this->_Shape, shape); return mkFuse.Shape(); } TopoDS_Shape TopoShape::section(TopoDS_Shape shape) const { + if (this->_Shape.IsNull()) + Standard_Failure::Raise("Base shape is null"); + if (shape.IsNull()) + Standard_Failure::Raise("Tool shape is null"); BRepAlgoAPI_Section mkSection(this->_Shape, shape); return mkSection.Shape(); }