From 9c5dbf040462a3f2d8ebd13efbe469f8d5c87bc1 Mon Sep 17 00:00:00 2001 From: Ash Date: Tue, 6 Nov 2018 21:12:17 +1100 Subject: [PATCH] render/wiiu: Safety checks on SDL_DestroyTexture --- src/render/wiiu/SDL_rtexture_wiiu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/render/wiiu/SDL_rtexture_wiiu.c b/src/render/wiiu/SDL_rtexture_wiiu.c index be533feea..101553ccd 100644 --- a/src/render/wiiu/SDL_rtexture_wiiu.c +++ b/src/render/wiiu/SDL_rtexture_wiiu.c @@ -135,7 +135,9 @@ int WIIU_SDL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, void WIIU_SDL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) { - WIIU_TextureData *tdata = (WIIU_TextureData *) texture->driverdata; + WIIU_TextureData *tdata; + if (texture == NULL || texture->driverdata == NULL) return; + tdata = (WIIU_TextureData *) texture->driverdata; free(tdata->texture.surface.image); SDL_free(tdata); }