guiscreen.cpp: Ensure successful SDL_GL_CreateContext

SDL_GL_CreateContext can fail due to several reasons, such as
GLXBadFBConfig on unsupported OpenGL versions.
This commit is contained in:
Xavier Del Campo Romero 2025-01-01 23:06:11 +01:00
parent 96d0dafac7
commit 21211a7aa5
Signed by: xavi
GPG key ID: 84FF3612A9BF43F2

View file

@ -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,