+ fix crash in DocumentObserverPython if a property has no name (because it's not part of an object)
This commit is contained in:
parent
9cb37116a7
commit
f9d2814572
|
@ -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&) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user