comparison src/SDL_compat.c @ 3034:0e821769fc51

Fixed NULL pointer dereference
author Sam Lantinga <slouken@libsdl.org>
date Tue, 13 Jan 2009 03:53:22 +0000
parents 77c3e67f0740
children 5f372cef955d
comparison
equal deleted inserted replaced
3033:4e4f47c5f941 3034:0e821769fc51
112 } 112 }
113 return actual_bpp; 113 return actual_bpp;
114 } 114 }
115 115
116 SDL_Rect ** 116 SDL_Rect **
117 SDL_ListModes(SDL_PixelFormat * format, Uint32 flags) 117 SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
118 { 118 {
119 int i, nmodes; 119 int i, nmodes;
120 SDL_Rect **modes; 120 SDL_Rect **modes;
121 121
122 if (!SDL_GetVideoDevice()) { 122 if (!SDL_GetVideoDevice()) {
123 return NULL; 123 return NULL;
124 } 124 }
125 125
126 if (!(flags & SDL_FULLSCREEN)) { 126 if (!(flags & SDL_FULLSCREEN)) {
127 return (SDL_Rect **) (-1); 127 return (SDL_Rect **) (-1);
128 }
129
130 if (!format) {
131 format = SDL_GetVideoInfo()->vfmt;
128 } 132 }
129 133
130 /* Memory leak, but this is a compatibility function, who cares? */ 134 /* Memory leak, but this is a compatibility function, who cares? */
131 nmodes = 0; 135 nmodes = 0;
132 modes = NULL; 136 modes = NULL;