From de44a747f6194bb57b6ccbb59b269d2b6ce4e459 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 31 Mar 2019 17:34:35 +0200 Subject: [PATCH] fix crash when checking an empty error message of an exception --- src/Gui/PythonConsole.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 5a95e64ab9..56b71255d4 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -323,7 +323,8 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const if (PyErr_Occurred()) { /* get latest python exception information */ PyObject *errobj, *errdata, *errtraceback; PyErr_Fetch(&errobj, &errdata, &errtraceback); - if (PyDict_Check(errdata)) { + // the error message can be empty so errdata will be null + if (errdata && PyDict_Check(errdata)) { PyObject* value = PyDict_GetItemString(errdata, "swhat"); if (value) { Base::RuntimeError e;