Navigation Menu

Skip to content

Commit

Permalink
+ fix crash in DocumentObserverPython if a property has no name (beca…
Browse files Browse the repository at this point in the history
…use it's not part of an object)
  • Loading branch information
wwmayer committed May 20, 2016
1 parent 9cb3711 commit f9d2814
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/App/DocumentObserverPython.cpp
Expand Up @@ -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<App::DocumentObject&>(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&) {
Expand Down

0 comments on commit f9d2814

Please sign in to comment.