Static analysis fix: division by zero.

--HG--
extra : histedit_source : 6f8f18284e016f09e4950279524047f97da0294a
This commit is contained in:
Ryan C. Gordon 2014-03-20 11:14:44 -04:00
parent b006893d9c
commit a23e431952
2 changed files with 9 additions and 2 deletions

View file

@ -404,6 +404,10 @@ SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format, int access, int w, int
if (!format) {
format = renderer->info.texture_formats[0];
}
if (SDL_BYTESPERPIXEL(format) == 0) {
SDL_SetError("Invalid texture format");
return NULL;
}
if (SDL_ISPIXELFORMAT_INDEXED(format)) {
SDL_SetError("Palettized textures are not supported");
return NULL;