fix crash on cancel primitive

This commit is contained in:
Stefan Tröger 2015-05-26 05:47:24 +02:00
parent 6347fe8c86
commit e7284ecde8

View File

@ -91,6 +91,9 @@ PartDesign::Body *getBody(bool messageIfNot)
PartDesign::Body *getBodyFor(App::DocumentObject* obj, bool messageIfNot)
{
if(!obj || !obj->isValid())
return nullptr;
PartDesign::Body * activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
if(activeBody && activeBody->hasFeature(obj))
return activeBody;
@ -112,6 +115,9 @@ PartDesign::Body *getBodyFor(App::DocumentObject* obj, bool messageIfNot)
App::Part* getPartFor(App::DocumentObject* obj, bool messageIfNot) {
if(!obj || !obj->isValid())
return nullptr;
PartDesign::Body* body = getBodyFor(obj, false);
if(body)
obj = body;