aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-10-19 09:46:19 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-20 13:03:01 +0000
commit7385f78ff8471db05843cb42ea5157fdd5e5fe76 (patch)
tree096b9931739a038a40687a2ed3bfabcef2d36a0d
parentdf2e69f6933ba86cdab240cf2812e2eab999c4b4 (diff)
libshiboken: Fix a crash with enums with no values
Handle null-return of PyDict_GetItem(). Task-number: PYSIDE-1691 Change-Id: Ia317cd15cf3d15c05e22a8b8db262d227c4dcb84 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit fcbe7aee1e97df0307f4d30185203a550cdd1b89) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/libshiboken/sbkenum.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp
index b97cff209..dbf338331 100644
--- a/sources/shiboken6/libshiboken/sbkenum.cpp
+++ b/sources/shiboken6/libshiboken/sbkenum.cpp
@@ -454,6 +454,8 @@ PyObject *getEnumItemFromValue(PyTypeObject *enumType, long itemValue)
PyObject *key, *value;
Py_ssize_t pos = 0;
PyObject *values = PyDict_GetItem(enumType->tp_dict, Shiboken::PyName::values());
+ if (values == nullptr)
+ return nullptr;
while (PyDict_Next(values, &pos, &key, &value)) {
auto *obj = reinterpret_cast<SbkEnumObject *>(value);