From 72328ed0a19f90a3cded06515bddea1bb770e5a3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 26 Jan 2016 12:48:15 +0100 Subject: [PATCH] + avoid throwing exceptions in property editor if not needed --- src/Gui/propertyeditor/PropertyItem.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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();