[Part] Fix null pointer error in sweep operation

When the spine line of the sweep operation of the part workbench depends
on the Sketcher document, if the dependent spine line drawn by this document
is deleted afterwards, the path variable will get a null pointer.
Due to programming errors, the standard judgment of this pointer is ignored, resulting in a crash.
Call IsNull() of the OCC document to determine the legitimacy of the shape.
If it is empty, an error is reported.

Fixes #0004764
This commit is contained in:
jack9603301
2021-10-14 03:43:20 +08:00
parent 5af1b03285
commit 67df930184

View File

@@ -544,6 +544,10 @@ App::DocumentObjectExecReturn *Sweep::execute(void)
break;
}
if(path.IsNull()) {
return new App::DocumentObjectExecReturn("Spine path missing, sweep operation stopped.");
}
if (path.ShapeType() == TopAbs_EDGE) {
BRepBuilderAPI_MakeWire mkWire(TopoDS::Edge(path));
path = mkWire.Wire();