From 7248888e0523b01b41d970f8fb28dd797aad41fb Mon Sep 17 00:00:00 2001 From: blobfish Date: Thu, 30 Apr 2015 11:20:11 -0400 Subject: [PATCH] PartDesign: Workbench: set active body post migration --- src/Mod/PartDesign/Gui/Workbench.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/Gui/Workbench.cpp b/src/Mod/PartDesign/Gui/Workbench.cpp index c6f67e7a0..f6cbc13d5 100644 --- a/src/Mod/PartDesign/Gui/Workbench.cpp +++ b/src/Mod/PartDesign/Gui/Workbench.cpp @@ -184,7 +184,8 @@ void Workbench::_doMigration(const App::Document* doc) // Always create at least the first body, even if the document is empty // This adds both the base planes and the body Gui::Command::runCommand(Gui::Command::Doc, "FreeCADGui.runCommand('PartDesign_Body')"); - PartDesign::Body *activeBody = Gui::Application::Instance->activeView()->getActiveObject("Body"); + PartDesign::Body *activeBody = Gui::Application::Instance->activeView()->getActiveObject("Body"); + assert(activeBody); // Create one Body for every root and put the appropriate features into it @@ -359,9 +360,12 @@ void Workbench::_switchToDocument(const App::Document* doc) // body have to be created assert(activeBody); - } else + } else { // empty document with no tip, so do migration _doMigration(doc); + activeBody = Gui::Application::Instance->activeView()->getActiveObject("Body"); + assert(activeBody); + } } else {