From abdc7daf5c4379fad965a10ecc0233b4c5b4fd48 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 4 Nov 2001 04:18:27 +0000 Subject: [PATCH] Fix a crash if an OpenGL video mode can't be set. --- src/video/SDL_video.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 89b1d2b75..b8ef36aa9 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -615,11 +615,12 @@ SDL_Surface * SDL_SetVideoMode (int width, int height, int bpp, Uint32 flags) mode = video->SetVideoMode(this, prev_mode,video_w,video_h,video_bpp,flags); if ( mode ) { /* Prevent resize events from mode change */ SDL_PrivateResize(mode->w, mode->h); - } - /* Sam - If we asked for an OpenGL mode, but didn't get it, fail */ - if ( is_opengl && !(mode->flags & SDL_OPENGL) ) { + + /* Sam - If we asked for OpenGL mode, and didn't get it, fail */ + if ( is_opengl && !(mode->flags & SDL_OPENGL) ) { mode = NULL; - } + } + } /* * rcg11292000 * If you try to set an SDL_OPENGL surface, and fail to find a