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 c6dc54b343

Change-Id: If1264b29af83f2a489785e3c4f3e8342716ea125
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2023-06-28 09:53:04 +02:00
parent 8bd6c95c97
commit 2e90cb643c

View File

@@ -214,7 +214,7 @@ int ManhattanStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
switch (metric) { switch (metric) {
#ifdef Q_OS_MACOS #ifdef Q_OS_MACOS
case PM_MenuButtonIndicator: case PM_MenuButtonIndicator:
if (widget && option->type == QStyleOption::SO_ToolButton) if (widget && option && option->type == QStyleOption::SO_ToolButton)
return 12; return 12;
break; break;
#endif #endif