summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Fanaskov <vitaly.fanaskov@qt.io>2019-10-24 14:24:42 +0200
committerVitaly Fanaskov <vitaly.fanaskov@qt.io>2019-10-24 15:02:56 +0200
commit5d5a0842dc87645eab468389198750adc01b0618 (patch)
treefc9d8b5a0ec021715d31e42fd5ca91185e796ce1
parent7a605edc226d4051602e157fe575f17dfaac0964 (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>
-rw-r--r--src/widgets/kernel/qapplication.cpp4
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);
}
}