From c5e1ae4580b1d2af5fcf6e70e72296a85d208212 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 17 Oct 2024 15:42:14 -0700
Subject: [PATCH] Only free debug_char_texture_atlas if it has been allocated
Fixes https://github.com/libsdl-org/SDL/issues/11254
---
src/render/SDL_render.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index b60bc861ccad8..7f2a354868818 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -5098,8 +5098,10 @@ void SDL_DestroyRendererWithoutFreeing(SDL_Renderer *renderer)
SDL_DiscardAllCommands(renderer);
- SDL_DestroyTexture(renderer->debug_char_texture_atlas);
- renderer->debug_char_texture_atlas = NULL;
+ if (renderer->debug_char_texture_atlas) {
+ SDL_DestroyTexture(renderer->debug_char_texture_atlas);
+ renderer->debug_char_texture_atlas = NULL;
+ }
// Free existing textures for this renderer
while (renderer->textures) {