From b76509bfea39d449ab3da84d5d0e1f7fa9c1dacb Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Thu, 26 Dec 2019 18:34:05 +0800 Subject: [PATCH] Gui: handle exception in property item display --- src/Gui/propertyeditor/PropertyItem.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 1c56a23fcc..2f029e1609 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -350,10 +350,8 @@ QVariant PropertyItem::toString(const QVariant& prop) const std::ostringstream ss; Base::PyGILStateLocker lock; try { - Base::PyGILStateLocker lock; - Py::Object pyobj(propertyItems[0]->getPyObject(), true); - std::ostringstream ss; - if (pyobj.isNone()) { + Py::Object pyobj(propertyItems[0]->getPyObject(),true); + if(pyobj.isNone()) { ss << ""; } else if(pyobj.isSequence()) { @@ -393,6 +391,7 @@ QVariant PropertyItem::toString(const QVariant& prop) const } else ss << pyobj.as_string(); + } catch (Py::Exception &) { Base::PyException e; ss.str("");