From 56e2e899555c99d4013fdbef940a79de9dc542ea Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Mon, 29 Aug 2022 13:39:30 +0200 Subject: Add nullptr check for theme when initializing palette Pick-to: 6.2 6.3 6.4 Change-Id: Iaac2c92f5f7e7fd5c25d6ecde058d4dc01c62aa1 Reviewed-by: Andy Nichols Reviewed-by: Volker Hilsheimer --- src/gui/kernel/qplatformtheme.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gui/kernel/qplatformtheme.cpp') 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); -- cgit v1.2.3