From 439ea67cc2f84267bfcb932a0c2efd818ce239ca Mon Sep 17 00:00:00 2001 From: Daniel Nagel Date: Tue, 2 Sep 2014 07:34:08 +0200 Subject: [PATCH] Add error handling for SDL_GL_CreateContext --- base/PCMain.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/base/PCMain.cpp b/base/PCMain.cpp index c1f80dd0e9..6afa48eb64 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -502,12 +502,17 @@ int main(int argc, char *argv[]) { g_Screen = SDL_CreateWindow(app_name_nice.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, pixel_xres, pixel_yres, mode); if (g_Screen == NULL) { - fprintf(stderr, "SDL SetVideoMode failed: Unable to create OpenGL screen: %s\n", SDL_GetError()); + fprintf(stderr, "SDL_CreateWindow failed: %s\n", SDL_GetError()); SDL_Quit(); return 2; } SDL_GLContext glContext = SDL_GL_CreateContext(g_Screen); + if (glContext == NULL) { + fprintf(stderr, "SDL_GL_CreateContext failed: %s\n", SDL_GetError()); + SDL_Quit(); + return 2; + } #ifdef USING_EGL EGL_Init();