add assertions to avoid crash with wrongly indexed graphics
This commit is contained in:
parent
654a2409ef
commit
2d27c0a764
1 changed files with 2 additions and 0 deletions
|
@ -1287,6 +1287,8 @@ void GraphicPlayerPixels(int colorIndex, const CGraphic &sprite)
|
|||
|
||||
Assert(SDL_MUSTLOCK(sprite.Surface) == 0);
|
||||
std::vector<SDL_Color> sdlColors = std::vector<SDL_Color>(PlayerColorsRGB[colorIndex].begin(), PlayerColorsRGB[colorIndex].end());
|
||||
Assert(sprite.Surface->format->palette);
|
||||
Assert(sprite.Surface->format->palette->ncolors > PlayerColorIndexStart + PlayerColorIndexCount);
|
||||
SDL_SetPaletteColors(sprite.Surface->format->palette, &sdlColors[0], PlayerColorIndexStart, PlayerColorIndexCount);
|
||||
if (sprite.SurfaceFlip) {
|
||||
SDL_SetPaletteColors(sprite.SurfaceFlip->format->palette, &sdlColors[0], PlayerColorIndexStart, PlayerColorIndexCount);
|
||||
|
|
Loading…
Reference in a new issue