From 42e85122181662a8a5c48b534efd642088960b26 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Oct 2023 14:39:43 +0200 Subject: Fix crashes related to broken QML decorators Task-number: PYSIDE-2432 Change-Id: I0108c944ce07e28f1af93a3f2adf51ebd76e92c4 Reviewed-by: Adrian Herrmann Reviewed-by: Cristian Maureira-Fredes (cherry picked from commit 3b086f648a2387989ff21f90660dca1404f7f734) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 02dfdfd61b99eb5780d1604c963f7e95d5b086ee) --- sources/shiboken6/libshiboken/sbkfeature_base.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/shiboken6/libshiboken/sbkfeature_base.cpp b/sources/shiboken6/libshiboken/sbkfeature_base.cpp index 1242cbda4..662e9276d 100644 --- a/sources/shiboken6/libshiboken/sbkfeature_base.cpp +++ b/sources/shiboken6/libshiboken/sbkfeature_base.cpp @@ -185,6 +185,9 @@ static PyObject *replaceNoArgWithZero(PyObject *callable) static PyObject *lookupUnqualifiedOrOldEnum(PyTypeObject *type, PyObject *name) { + // MRO has been observed to be 0 in case of errors with QML decorators + if (type == nullptr || type->tp_mro == nullptr) + return nullptr; static PyTypeObject *const EnumMeta = getPyEnumMeta(); static PyObject *const _member_map_ = String::createStaticString("_member_map_"); // This is similar to `find_name_in_mro`, but instead of looking directly into -- cgit v1.2.3