Fixed bug 1923 - Crash with SDL_SetColorKey
Sylvain 1/ Load an Image XPM with IMG_ReadXPMFromArray() 2/ Try to set a ColorKey on it. I notice that : - the SDL_Surface that is created from XPM has a palette ! - the colorkey is a RBG. it crashes (SIGSEGV) inside the SDL_SetColorKey function: "surface->format->palette->colors[surface->map->info.colorkey].a"
This commit is contained in:
parent
91452f6355
commit
185f93a7a9
1 changed files with 5 additions and 1 deletions
|
@ -175,7 +175,11 @@ SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key)
|
|||
int flags;
|
||||
|
||||
if (!surface) {
|
||||
return -1;
|
||||
return SDL_InvalidParamError("surface");
|
||||
}
|
||||
|
||||
if (surface->format->palette && key >= surface->format->palette->ncolors) {
|
||||
return SDL_InvalidParamError("key");
|
||||
}
|
||||
|
||||
if (flag & SDL_RLEACCEL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue