diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 02781f4aa0..dd41318f72 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -170,6 +170,9 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context qWarning("No QTLS available. currentContext won't work"); return nullptr; } + if (!context) + return nullptr; + threadContext = new QGuiGLThreadContext; qwindow_context_storage()->setLocalData(threadContext); }