Check platformNativeInterface pointer before dereferencing

QApplication::platformNativeInterface() returns null if started with
-platform offscreen.

Fixes: QTBUG-80946
Change-Id: I3ad03ad27148c8576bd3fab0b136827bb8d171ae
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Shawn Rutledge 2019-12-27 11:48:26 +01:00
parent a63969081c
commit 4b1d370f75
2 changed files with 4 additions and 0 deletions

View File

@ -1364,6 +1364,8 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
createWinId();
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface)
return; // Not Cocoa platform plugin.
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration("setContentBorderEnabled");
if (!function)

View File

@ -360,6 +360,8 @@ void QToolBarLayout::updateMacBorderMetrics()
return;
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
if (!nativeInterface)
return; // Not Cocoa platform plugin.
QPlatformNativeInterface::NativeResourceForIntegrationFunction function =
nativeInterface->nativeResourceFunctionForIntegration("registerContentBorderArea");
if (!function)