Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Don't crash if the current render target is destroyed.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 12, 2013
1 parent 264f262 commit be28778
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/render/SDL_render.c
Expand Up @@ -1691,9 +1691,14 @@ SDL_DestroyTexture(SDL_Texture * texture)
SDL_Renderer *renderer;

CHECK_TEXTURE_MAGIC(texture, );
texture->magic = NULL;

renderer = texture->renderer;
if (texture == renderer->target) {
SDL_SetRenderTarget(renderer, NULL);
}

texture->magic = NULL;

if (texture->next) {
texture->next->prev = texture->prev;
}
Expand Down

0 comments on commit be28778

Please sign in to comment.