From aa5f3c829c308b6765aa390524ad840bd33258e8 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 8 Sep 2020 12:03:48 +0200 Subject: [PATCH] Avoid crashing in offscreen with X11 builtin but not available Pick-to: 5.15 Change-Id: Id385bc750f1cc6dfc2ad7e0248dbc56fa5b6e4d2 Reviewed-by: Michal Klocek Reviewed-by: Qt CI Bot --- .../platforms/offscreen/qoffscreenintegration_x11.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp index c866a55dc0..bb4d8aeaa1 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp @@ -118,13 +118,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;