From f9d28145727f15f4abb00d18e2f3ed85e95bbb4b Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 20 May 2016 13:57:30 +0200 Subject: [PATCH] + fix crash in DocumentObserverPython if a property has no name (because it's not part of an object) --- src/App/DocumentObserverPython.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/App/DocumentObserverPython.cpp b/src/App/DocumentObserverPython.cpp index 0bfe02807..417bab899 100644 --- a/src/App/DocumentObserverPython.cpp +++ b/src/App/DocumentObserverPython.cpp @@ -239,9 +239,13 @@ void DocumentObserverPython::slotChangedObject(const App::DocumentObject& Obj, Py::Callable method(this->inst.getAttr(std::string("slotChangedObject"))); Py::Tuple args(2); args.setItem(0, Py::Object(const_cast(Obj).getPyObject(), true)); - std::string prop_name = Obj.getPropertyName(&Prop); - args.setItem(1, Py::String(prop_name)); - method.apply(args); + // If a property is touched but not part of a document object then its name is null. + // In this case the slot function must not be called. + const char* prop_name = Obj.getPropertyName(&Prop); + if (prop_name) { + args.setItem(1, Py::String(prop_name)); + method.apply(args); + } } } catch (Py::Exception&) {