Commit 20f51b1fd736c7031540007ad60262622d84c6d2

Sam Lantinga 2022-07-22T10:58:29

Fixed crash if debug text wasn't drawn during a session

diff --git a/src/test/SDL_test_font.c b/src/test/SDL_test_font.c
index 91a620f..3bfcf49 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;
 }