From 2e90cb643cb9acbe8a31b8a91e08f53ca2751ecb Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 28 Jun 2023 09:53:04 +0200 Subject: [PATCH] ManhattanStyle: Fix crash with stylesheets Most prominently QmlDesigner crashed. Some widgets have stylesheets set, and QStyleSheetStyle sometimes asks for pixelMetric with nullptr as styleoption. Amends c6dc54b34366c98273bf1992e0f54da5e085ca05 Change-Id: If1264b29af83f2a489785e3c4f3e8342716ea125 Reviewed-by: Marcus Tillmanns Reviewed-by: Alessandro Portale --- src/plugins/coreplugin/manhattanstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 0f16100e11e..e3205dae6d8 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -214,7 +214,7 @@ int ManhattanStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, switch (metric) { #ifdef Q_OS_MACOS case PM_MenuButtonIndicator: - if (widget && option->type == QStyleOption::SO_ToolButton) + if (widget && option && option->type == QStyleOption::SO_ToolButton) return 12; break; #endif