From 20f51b1fd736c7031540007ad60262622d84c6d2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 22 Jul 2022 10:58:29 -0700 Subject: [PATCH] Fixed crash if debug text wasn't drawn during a session --- src/test/SDL_test_font.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/SDL_test_font.c b/src/test/SDL_test_font.c index 91a620fd2..3bfcf4970 100644 --- a/src/test/SDL_test_font.c +++ b/src/test/SDL_test_font.c @@ -3478,7 +3478,7 @@ void SDLTest_CleanupTextDrawing(void) struct SDLTest_CharTextureCache* cache, *next; cache = SDLTest_CharTextureCacheList; - do { + while (cache) { for (i = 0; i < SDL_arraysize(cache->charTextureCache); ++i) { if (cache->charTextureCache[i]) { SDL_DestroyTexture(cache->charTextureCache[i]); @@ -3489,7 +3489,7 @@ void SDLTest_CleanupTextDrawing(void) next = cache->next; SDL_free(cache); cache = next; - } while (cache); + } SDLTest_CharTextureCacheList = NULL; }