mirror of https://git.ffmpeg.org/ffmpeg.git
ffplay: Fix realloc_texture when input texture is NULL.
SDL_QueryTexture and SDL_DestroyTexture require that the input texture pointer be non-null. Debug builds of SDL will correctly check for this and break program execution. This patch fixes this by checking the status of the texture pointer. Signed-off-by: Matt Oliver <protogonoi@gmail.com>
This commit is contained in:
parent
223f3dff8c
commit
6be690685a
|
@ -834,10 +834,11 @@ static int realloc_texture(SDL_Texture **texture, Uint32 new_format, int new_wid
|
||||||
{
|
{
|
||||||
Uint32 format;
|
Uint32 format;
|
||||||
int access, w, h;
|
int access, w, h;
|
||||||
if (SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) {
|
if (!*texture || SDL_QueryTexture(*texture, &format, &access, &w, &h) < 0 || new_width != w || new_height != h || new_format != format) {
|
||||||
void *pixels;
|
void *pixels;
|
||||||
int pitch;
|
int pitch;
|
||||||
SDL_DestroyTexture(*texture);
|
if (*texture)
|
||||||
|
SDL_DestroyTexture(*texture);
|
||||||
if (!(*texture = SDL_CreateTexture(renderer, new_format, SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
|
if (!(*texture = SDL_CreateTexture(renderer, new_format, SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
|
||||||
return -1;
|
return -1;
|
||||||
if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)
|
if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)
|
||||||
|
|
Loading…
Reference in New Issue