From 88bbcc34e2b6dfb3b42050ca9d3f36652c0b4420 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 7 Aug 2020 01:03:24 -0500 Subject: [PATCH] [nostalgia/core/sdl] Make only destroy textures that actually exist --- src/nostalgia/core/sdl/gfx.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nostalgia/core/sdl/gfx.cpp b/src/nostalgia/core/sdl/gfx.cpp index f4ebe24f..09e06eb2 100644 --- a/src/nostalgia/core/sdl/gfx.cpp +++ b/src/nostalgia/core/sdl/gfx.cpp @@ -62,7 +62,9 @@ ox::Error initGfx(Context *ctx) { ox::Error shutdownGfx(Context *ctx) { auto id = ctx->implData(); for (auto tex : id->bgTextures) { - SDL_DestroyTexture(tex); + if (tex) { + SDL_DestroyTexture(tex); + } } SDL_DestroyRenderer(id->renderer); SDL_DestroyWindow(id->window);