From 791187cd12e0f784925c593d6ddc3e46c3f5ce1d Mon Sep 17 00:00:00 2001 From: rubidium Date: Tue, 30 Jun 2009 12:36:24 +0000 Subject: (svn r16699) -Fix [FS#3001]: if SDL fails to allocate a surface due to it being too large (and SDL doesn't crash!) fall back to another video driver. --- src/video/sdl_v.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index f00ab10bc..0592803e5 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -426,11 +426,14 @@ const char *VideoDriver_SDL::Start(const char * const *parm) const char *s = SdlOpen(SDL_INIT_VIDEO); if (s != NULL) return s; + GetVideoModes(); + if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) { + return SDL_CALL SDL_GetError(); + } + SDL_CALL SDL_VideoDriverName(buf, 30); DEBUG(driver, 1, "SDL: using driver '%s'", buf); - GetVideoModes(); - CreateMainSurface(_cur_resolution.width, _cur_resolution.height); MarkWholeScreenDirty(); SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); -- cgit v1.2.3-70-g09d2