fix part and body search for invalid objects

This commit is contained in:
Stefan Tröger
2015-06-02 17:08:02 +02:00
parent 3aae4ce011
commit 20d551bc88
2 changed files with 8 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ namespace PartDesignGui {
PartDesign::Body *getBody(bool messageIfNot)
{
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
if (!activeBody && messageIfNot){
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("No active Body"),
@@ -85,13 +85,13 @@ PartDesign::Body *getBody(bool messageIfNot)
"PartDesign to put them into a Body."
));
}
return activeBody;
return activeBody;
}
PartDesign::Body *getBodyFor(App::DocumentObject* obj, bool messageIfNot)
{
if(!obj || !obj->isValid())
if(!obj)
return nullptr;
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
@@ -115,7 +115,7 @@ PartDesign::Body *getBodyFor(App::DocumentObject* obj, bool messageIfNot)
App::Part* getPartFor(App::DocumentObject* obj, bool messageIfNot) {
if(!obj || !obj->isValid())
if(!obj)
return nullptr;
PartDesign::Body* body = getBodyFor(obj, false);