From b17151eb16e18354adc2412afb9c451f903188f5 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 14 Oct 2023 13:43:22 -0400 Subject: [PATCH] testaudio: Don't crash if renderer is NULL (happens during shutdown). --- test/testaudio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/testaudio.c b/test/testaudio.c index 3cb71a764..1508098f2 100644 --- a/test/testaudio.c +++ b/test/testaudio.c @@ -416,11 +416,13 @@ static void DrawThings(SDL_Renderer *renderer) static void Draw(void) { SDL_Renderer *renderer = state->renderers[0]; - SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); - SDL_SetRenderDrawColor(renderer, 64, 0, 64, 255); - SDL_RenderClear(renderer); - DrawThings(renderer); - SDL_RenderPresent(renderer); + if (renderer) { /* might be NULL if we're shutting down. */ + SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); + SDL_SetRenderDrawColor(renderer, 64, 0, 64, 255); + SDL_RenderClear(renderer); + DrawThings(renderer); + SDL_RenderPresent(renderer); + } } static void RepositionRowOfThings(const ThingType what, const float y)