diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 554daeeb0..db8e4c0b2 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -83,27 +83,27 @@ void PropertyItem::reset() void PropertyItem::setPropertyData(const std::vector& items) { //if we have a single property we can bind it for expression handling - if(items.size() == 1) { - + if (items.size() == 1) { const App::Property& p = *items.front(); - + try { - if(!(p.getContainer()->isReadOnly(&p))) { - + // Check for 'DocumentObject' as parent because otherwise 'ObjectIdentifier' raises an exception + App::DocumentObject * docObj = Base::freecad_dynamic_cast(p.getContainer()); + if (docObj && !docObj->isReadOnly(&p)) { App::ObjectIdentifier id(p); std::vector paths; p.getPaths(paths); - + //there may be no paths available in this property (for example an empty constraint list) - if(id.getProperty() && !paths.empty()) + if (id.getProperty() && !paths.empty()) bind(id); - } } //it may happen that setting properties is not possible - catch(...) {}; + catch (...) { + } } - + propertyItems = items; updateData(); this->initialize();