From 63db0b910a2df93d2cf19af05013e3595a704658 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 1 Jan 2025 23:06:11 +0100 Subject: [PATCH] guiscreen.cpp: Ensure successful SDL_GL_CreateContext SDL_GL_CreateContext can fail due to several reasons, such as GLXBadFBConfig on unsupported OpenGL versions. --- src/libs/tgfclient/guiscreen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/tgfclient/guiscreen.cpp b/src/libs/tgfclient/guiscreen.cpp index 4ae1a176e..09febfc99 100644 --- a/src/libs/tgfclient/guiscreen.cpp +++ b/src/libs/tgfclient/guiscreen.cpp @@ -377,7 +377,11 @@ SDL_Surface* gfScrCreateWindow(int nWinWidth, int nWinHeight, int nTotalDepth,in } #endif /* Create OpenGL context */ - GLContext = SDL_GL_CreateContext(GfuiWindow); + if (!(GLContext = SDL_GL_CreateContext(GfuiWindow))) + { + GfLogError("SDL_GL_CreateContext failed: %s\n", SDL_GetError()); + return nullptr; + } // If specified, try best possible settings. PScreenSurface = SDL_CreateRGBSurface(0, nWinWidth, nWinHeight, nTotalDepth,