Fixed crash in testpalette and potential crash in SDL_LoadBMP_RW()

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403312
This commit is contained in:
Sam Lantinga 2008-12-07 22:25:16 +00:00
parent a1b17450ce
commit 45899bac10
2 changed files with 16 additions and 0 deletions

View file

@ -189,6 +189,8 @@ main(int argc, char **argv)
SDL_SetColorKey(boat[0], SDL_SRCCOLORKEY | SDL_RLEACCEL,
SDL_MapRGB(boat[0]->format, 0xff, 0x00, 0xff));
boatcols = boat[0]->format->palette->ncolors;
if (boatcols >= 256)
sdlerr("too many colors in sail.bmp");
boat[1] = hflip(boat[0]);
SDL_SetColorKey(boat[1], SDL_SRCCOLORKEY | SDL_RLEACCEL,
SDL_MapRGB(boat[1]->format, 0xff, 0x00, 0xff));