diff options
author | Vitaly Fanaskov <vitaly.fanaskov@qt.io> | 2019-10-24 14:24:42 +0200 |
---|---|---|
committer | Vitaly Fanaskov <vitaly.fanaskov@qt.io> | 2019-10-24 15:02:56 +0200 |
commit | 5d5a0842dc87645eab468389198750adc01b0618 (patch) | |
tree | fc9d8b5a0ec021715d31e42fd5ca91185e796ce1 /src | |
parent | 7a605edc226d4051602e157fe575f17dfaac0964 (diff) |
QApplicationPrivate: Fix potential null pointer dereference
The situation when qGuiApp is null is possible, for example, during
static palette setup. This is also a bon ton to check pointers before
dereferencing them.
Task-number: QTBUG-71186
Change-Id: I8021cef073eedaa0e4c2eb621890e73e8126175c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3223781b63..3ded8c37e6 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1395,7 +1395,9 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* else *QApplicationPrivate::set_pal = palette; QCoreApplication::setAttribute(Qt::AA_SetPalette); - emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); + + if (qGuiApp && QGuiApplicationPrivate::app_pal) + emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); } } |