Fixed NULL pointer dereference

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403496
This commit is contained in:
Sam Lantinga 2009-01-13 03:53:22 +00:00
parent aa47998f53
commit 97baa9c439
3 changed files with 9 additions and 5 deletions

View file

@ -114,7 +114,7 @@ SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags)
}
SDL_Rect **
SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
SDL_ListModes(const SDL_PixelFormat * format, Uint32 flags)
{
int i, nmodes;
SDL_Rect **modes;
@ -127,6 +127,10 @@ SDL_ListModes(SDL_PixelFormat * format, Uint32 flags)
return (SDL_Rect **) (-1);
}
if (!format) {
format = SDL_GetVideoInfo()->vfmt;
}
/* Memory leak, but this is a compatibility function, who cares? */
nmodes = 0;
modes = NULL;