Don't crash if the current render target is destroyed.

This commit is contained in:
Sam Lantinga 2013-07-12 00:43:16 -07:00
parent 852321d7a2
commit 1bcb90ff25

View file

@ -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;
}