PartDesign/Workbench: fix a crash

This commit is contained in:
Alexander Golubev 2015-07-31 07:38:24 +03:00 committed by Stefan Tröger
parent 147aff0395
commit e6a99ce96f

View File

@ -75,7 +75,12 @@ namespace PartDesignGui {
PartDesign::Body *getBody(bool messageIfNot)
{
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
PartDesign::Body * activeBody = nullptr;
Gui::MDIView *activeView = Gui::Application::Instance->activeView();
if (activeView) {
activeBody = activeView->getActiveObject<PartDesign::Body*>(PDBODYKEY);
}
if (!activeBody && messageIfNot) {
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Body"),