check for null shapes before performing boolean operation

This commit is contained in:
wmayer
2017-09-10 12:41:46 +02:00
parent 4e413800ee
commit 832e18689b

View File

@@ -100,10 +100,17 @@ App::DocumentObjectExecReturn *Boolean::execute(void)
// so that the placement will be right
if(!tool->isDerivedFrom(Part::Feature::getClassTypeId()))
return new App::DocumentObjectExecReturn("Cannot do boolean with anything but Part::Feature and its derivatives");
TopoDS_Shape shape = static_cast<Part::Feature*>(tool)->Shape.getValue();
TopoDS_Shape boolOp;
// Must not pass null shapes to the boolean operations
if (result.IsNull())
return new App::DocumentObjectExecReturn("Base shape is null");
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Tool shape is null");
if (type == "Fuse") {
BRepAlgoAPI_Fuse mkFuse(result, shape);
if (!mkFuse.IsDone())