comparison src/video/x11/SDL_x11modes.c @ 713:7c8deec1659c

Fixed X11 mode line crash with only one video mode (thanks Alan!)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 05 Sep 2003 15:18:46 +0000
parents df178851293b
children b8d311d90021
comparison
equal deleted inserted replaced
712:8be92df64b22 713:7c8deec1659c
118 if ( (modes[i]->hdisplay == width) && 118 if ( (modes[i]->hdisplay == width) &&
119 (modes[i]->vdisplay == height) ) 119 (modes[i]->vdisplay == height) )
120 goto match; 120 goto match;
121 } 121 }
122 qsort(modes, nmodes, sizeof *modes, cmpmodes); 122 qsort(modes, nmodes, sizeof *modes, cmpmodes);
123 for ( i = nmodes-1; i >= 0 ; i-- ) { 123 for ( i = nmodes-1; i > 0 ; i-- ) {
124 if ( ! best_width ) { 124 if ( ! best_width ) {
125 if ( (modes[i]->hdisplay >= width) && 125 if ( (modes[i]->hdisplay >= width) &&
126 (modes[i]->vdisplay >= height) ) { 126 (modes[i]->vdisplay >= height) ) {
127 best_width = modes[i]->hdisplay; 127 best_width = modes[i]->hdisplay;
128 best_height = modes[i]->vdisplay; 128 best_height = modes[i]->vdisplay;