summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qplatformtheme.cpp
diff options
context:
space:
mode:
authorDoris Verria <doris.verria@qt.io>2022-08-29 13:39:30 +0200
committerDoris Verria <doris.verria@qt.io>2022-08-30 03:00:04 +0200
commit56e2e899555c99d4013fdbef940a79de9dc542ea (patch)
tree8c567aecc60b28cf9b94a9081a9a77234b8f7353 /src/gui/kernel/qplatformtheme.cpp
parent39cea8900b02479aca222ba1f4b4bc54a9c27f02 (diff)
Add nullptr check for theme when initializing palette
Pick-to: 6.2 6.3 6.4 Change-Id: Iaac2c92f5f7e7fd5c25d6ecde058d4dc01c62aa1 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qplatformtheme.cpp')
-rw-r--r--src/gui/kernel/qplatformtheme.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index fe044bd1be..8e8d7b3be5 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -344,8 +344,10 @@ QPlatformThemePrivate::~QPlatformThemePrivate()
Q_GUI_EXPORT QPalette qt_fusionPalette()
{
- const bool darkAppearance = QGuiApplicationPrivate::platformTheme()->appearance()
- == QPlatformTheme::Appearance::Dark;
+ auto theme = QGuiApplicationPrivate::platformTheme();
+ const bool darkAppearance = theme
+ ? theme->appearance() == QPlatformTheme::Appearance::Dark
+ : false;
const QColor windowText = darkAppearance ? QColor(240, 240, 240) : Qt::black;
const QColor backGround = darkAppearance ? QColor(50, 50, 50) : QColor(239, 239, 239);
const QColor light = backGround.lighter(150);