Commit 97baa9c4 authored by Sam Lantinga's avatar Sam Lantinga

Fixed NULL pointer dereference

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403496
parent aa47998f
...@@ -25,8 +25,9 @@ Thanks to everyone who made this possible, including: ...@@ -25,8 +25,9 @@ Thanks to everyone who made this possible, including:
* Szymon "Wilku" Wilczek for adding support for multiple mice and tablets * Szymon "Wilku" Wilczek for adding support for multiple mice and tablets
during the Google Summer of Code 2008 during the Google Summer of Code 2008
* Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, and Couriersud * Marty Leisner, Andrew, Will, Edgar Simo, Donny Viszneki, Andrea Mazzoleni,
for helping find SDL 1.3 bugs in the great SDL Bug Hunt of January 2009! and Couriersud for helping find SDL 1.3 bugs in the great SDL Bug Hunt
of January 2009!
* Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of * Donny Viszneki for helping fix SDL 1.3 bugs in the great SDL Bug Hunt of
January 2009! January 2009!
......
...@@ -228,8 +228,7 @@ extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void); ...@@ -228,8 +228,7 @@ extern DECLSPEC const SDL_VideoInfo *SDLCALL SDL_GetVideoInfo(void);
extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width,
int height, int height,
int bpp, Uint32 flags); int bpp, Uint32 flags);
extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(SDL_PixelFormat * format, extern DECLSPEC SDL_Rect **SDLCALL SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags);
Uint32 flags);
extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width, extern DECLSPEC SDL_Surface *SDLCALL SDL_SetVideoMode(int width,
int height, int height,
int bpp, Uint32 flags); int bpp, Uint32 flags);
......
...@@ -114,7 +114,7 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags) ...@@ -114,7 +114,7 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
} }
SDL_Rect ** SDL_Rect **
SDL_ListModes(SDL_PixelFormat * format, Uint32 flags) SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
{ {
int i, nmodes; int i, nmodes;
SDL_Rect **modes; SDL_Rect **modes;
...@@ -127,6 +127,10 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags) ...@@ -127,6 +127,10 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
return (SDL_Rect **) (-1); return (SDL_Rect **) (-1);
} }
if (!format) {
format = SDL_GetVideoInfo()->vfmt;
}
/* Memory leak, but this is a compatibility function, who cares? */ /* Memory leak, but this is a compatibility function, who cares? */
nmodes = 0; nmodes = 0;
modes = NULL; modes = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment