From 4bcb79c3152e1efcf7205fa4c067038d6157b4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 15 Feb 2016 21:52:17 +0100 Subject: [PATCH] Platform: properly handle SDL2 context creation failure on Emscripten. --- src/Magnum/Platform/Sdl2Application.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index c8ac7ace5..361a522b1 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -244,7 +244,10 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { #else /* Emscripten-specific initialization */ - _glContext = SDL_SetVideoMode(configuration.size().x(), configuration.size().y(), 24, SDL_OPENGL|SDL_HWSURFACE|SDL_DOUBLEBUF); + if(!(_glContext = SDL_SetVideoMode(configuration.size().x(), configuration.size().y(), 24, SDL_OPENGL|SDL_HWSURFACE|SDL_DOUBLEBUF))) { + Error() << "Platform::Sdl2Application::tryCreateContext(): cannot create context:" << SDL_GetError(); + return false; + } #endif /* Return true if the initialization succeeds */