From 88a1a9482e15261b30e5d5452536dca1c8bc5471 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sun, 25 Aug 2019 21:31:42 +0800 Subject: [PATCH] App: fix crash on accessing non-existent attribute in ObjectIdentifier --- src/App/ObjectIdentifier.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/App/ObjectIdentifier.cpp b/src/App/ObjectIdentifier.cpp index 65a5cd425e..6914439317 100644 --- a/src/App/ObjectIdentifier.cpp +++ b/src/App/ObjectIdentifier.cpp @@ -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())