From fbe6a6e1680e816d72b10323b315446ff4c4ad83 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 8 Sep 2020 12:03:48 +0200 Subject: Avoid crashing in offscreen with X11 builtin but not available Change-Id: Id385bc750f1cc6dfc2ad7e0248dbc56fa5b6e4d2 Reviewed-by: Michal Klocek Reviewed-by: Qt CI Bot (cherry picked from commit aa5f3c829c308b6765aa390524ad840bd33258e8) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp index 84991d751f..9c391e2be7 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp @@ -119,13 +119,15 @@ void *QOffscreenX11Integration::nativeResourceForContext(const QByteArray &resou if (resource.toLower() == QByteArrayLiteral("glxconfig") ) { if (context) { QOffscreenX11GLXContext *glxPlatformContext = static_cast(context->handle()); - return glxPlatformContext->glxConfig(); + if (glxPlatformContext) + return glxPlatformContext->glxConfig(); } } if (resource.toLower() == QByteArrayLiteral("glxcontext") ) { if (context) { QOffscreenX11GLXContext *glxPlatformContext = static_cast(context->handle()); - return glxPlatformContext->glxContext(); + if (glxPlatformContext) + return glxPlatformContext->glxContext(); } } return nullptr; -- cgit v1.2.1