Fix crash when adding datum and there's no active body

Plus fix double messageboxes about the lack of the body,
This commit is contained in:
DeepSOIC
2015-05-14 00:18:47 +03:00
committed by Stefan Tröger
parent fe59e5286e
commit 439f392e88
5 changed files with 38 additions and 22 deletions

View File

@@ -73,11 +73,11 @@ namespace PartDesignGui {
// Helper for Body
//===========================================================================
PartDesign::Body *getBody(void)
PartDesign::Body *getBody(bool messageIfNot)
{
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
if (!activeBody){
if (!activeBody && messageIfNot){
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Body"),
QObject::tr("In order to use PartDesign you need an active Body object in the document. "
"Please make one active (double click) or create one. If you have a legacy document "