App: fix crash on accessing non-existent attribute in ObjectIdentifier

This commit is contained in:
Zheng, Lei
2019-08-25 21:31:42 +08:00
committed by wmayer
parent f0cb6d5885
commit 88a1a9482e

View File

@@ -600,6 +600,8 @@ size_t ObjectIdentifier::Component::getIndex(size_t count) const {
Py::Object ObjectIdentifier::Component::get(const Py::Object &pyobj) const {
Py::Object res;
if(isSimple()) {
if(!pyobj.hasAttr(getName()))
FC_THROWM(Base::AttributeError, "No attribute named '" << getName() << "'");
res = pyobj.getAttr(getName());
} else if(isArray()) {
if(pyobj.isMapping())