changeset 229:4d24d5a660a8

Fix a crash if an OpenGL video mode can't be set.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Nov 2001 04:18:27 +0000
parents 153f221b7d48
children 275a934573a7
files src/video/SDL_video.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/SDL_video.c	Sun Nov 04 04:18:05 2001 +0000
+++ b/src/video/SDL_video.c	Sun Nov 04 04:18:27 2001 +0000
@@ -615,11 +615,12 @@
 	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 OpenGL mode, and didn't get it, fail */
+	    if ( is_opengl && !(mode->flags & SDL_OPENGL) ) {
+		mode = NULL;
+	    }
         }
-	/* Sam - If we asked for an OpenGL mode, but 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