diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index d8da482ecc3..ecbae48ec35 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -154,6 +154,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); }