Fix a crash if an OpenGL video mode can't be set.
authorSam Lantinga <slouken@libsdl.org>
Sun, 04 Nov 2001 04:18:27 +0000
changeset 2294d24d5a660a8
parent 228 153f221b7d48
child 230 275a934573a7
Fix a crash if an OpenGL video mode can't be set.
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Sun Nov 04 04:18:05 2001 +0000
     1.2 +++ b/src/video/SDL_video.c	Sun Nov 04 04:18:27 2001 +0000
     1.3 @@ -615,11 +615,12 @@
     1.4  	mode = video->SetVideoMode(this, prev_mode,video_w,video_h,video_bpp,flags);
     1.5  	if ( mode ) { /* Prevent resize events from mode change */
     1.6  	    SDL_PrivateResize(mode->w, mode->h);
     1.7 +
     1.8 +	    /* Sam - If we asked for OpenGL mode, and didn't get it, fail */
     1.9 +	    if ( is_opengl && !(mode->flags & SDL_OPENGL) ) {
    1.10 +		mode = NULL;
    1.11 +	    }
    1.12          }
    1.13 -	/* Sam - If we asked for an OpenGL mode, but didn't get it, fail */
    1.14 -	if ( is_opengl && !(mode->flags & SDL_OPENGL) ) {
    1.15 -		mode = NULL;
    1.16 -	}
    1.17  	/*
    1.18  	 * rcg11292000
    1.19  	 * If you try to set an SDL_OPENGL surface, and fail to find a