fix crash in ViewProviderBody::setVisualBodyMode due to missing view provider
This commit is contained in:
@@ -379,16 +379,16 @@ void ViewProviderBody::unifyVisualProperty(const App::Property* prop) {
|
||||
prop == &Selectable ||
|
||||
prop == &DisplayModeBody)
|
||||
return;
|
||||
|
||||
|
||||
Gui::Document *gdoc = Gui::Application::Instance->getDocument ( pcObject->getDocument() ) ;
|
||||
|
||||
|
||||
PartDesign::Body *body = static_cast<PartDesign::Body *> ( getObject() );
|
||||
auto features = body->Group.getValues();
|
||||
for(auto feature : features) {
|
||||
|
||||
if(!feature->isDerivedFrom(PartDesign::Feature::getClassTypeId()))
|
||||
continue;
|
||||
|
||||
|
||||
//copy over the properties data
|
||||
auto p = gdoc->getViewProvider(feature)->getPropertyByName(prop->getName());
|
||||
p->Paste(*prop);
|
||||
@@ -398,15 +398,16 @@ void ViewProviderBody::unifyVisualProperty(const App::Property* prop) {
|
||||
void ViewProviderBody::setVisualBodyMode(bool bodymode) {
|
||||
|
||||
Gui::Document *gdoc = Gui::Application::Instance->getDocument ( pcObject->getDocument() ) ;
|
||||
|
||||
|
||||
PartDesign::Body *body = static_cast<PartDesign::Body *> ( getObject() );
|
||||
auto features = body->Group.getValues();
|
||||
for(auto feature : features) {
|
||||
|
||||
if(!feature->isDerivedFrom(PartDesign::Feature::getClassTypeId()))
|
||||
continue;
|
||||
|
||||
static_cast<PartDesignGui::ViewProvider*>(gdoc->getViewProvider(feature))->setBodyMode(bodymode);
|
||||
|
||||
auto* vp = static_cast<PartDesignGui::ViewProvider*>(gdoc->getViewProvider(feature));
|
||||
if (vp) vp->setBodyMode(bodymode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user