aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-08-27 15:12:15 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-08-30 11:06:30 +0200
commit7e198983b4768a547b2cd30e410bccb53368b842 (patch)
tree09d6f4b8fb8c0aea808e3c04c2d7b3df09985475 /sources
parent1499573a7b4d69aac89b3d941670fd5976a12e80 (diff)
Fix crash when constructing a QApplication in an embedded application
The check code itself crashed when qApp_last == nullptr. Fixes: PYSIDE-1647 Change-Id: Id8839bf551ad63f6ef2a1a997dabf455d3588c11 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 2c41d10a6a1f6fb7b496fc8c4c59e377b819f634) Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index ab637354e..d84302458 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -542,7 +542,8 @@ PyObject *MakeQAppWrapper(PyTypeObject *type)
// protecting from multiple application instances
if (!(type == nullptr || qApp_last == Py_None)) {
- const char *res_name = PepType_GetNameStr(Py_TYPE(qApp_last));
+ const char *res_name = qApp_last != nullptr
+ ? PepType_GetNameStr(Py_TYPE(qApp_last)) : "<Unknown>";
const char *type_name = PepType_GetNameStr(type);
PyErr_Format(PyExc_RuntimeError, "Please destroy the %s singleton before"
" creating a new %s instance.", res_name, type_name);