diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index e056dab24d..e9e605c32a 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -75,7 +75,12 @@ namespace PartDesignGui { PartDesign::Body *getBody(bool messageIfNot) { - PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject(PDBODYKEY); + PartDesign::Body * activeBody = nullptr; + Gui::MDIView *activeView = Gui::Application::Instance->activeView(); + + if (activeView) { + activeBody = activeView->getActiveObject(PDBODYKEY); + } if (!activeBody && messageIfNot) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Body"),