From 9a36d01fcc2c3e0d850963f9e7873b2cbd0549fb Mon Sep 17 00:00:00 2001 From: jack9603301 Date: Thu, 14 Oct 2021 03:43:20 +0800 Subject: [PATCH] [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 --- src/Mod/Part/App/PartFeatures.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index 4d9e1fc0f9..469dc4a22e 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -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();