testaudio: Don't crash if renderer is NULL (happens during shutdown).

main
Ryan C. Gordon 2023-10-14 13:43:22 -04:00
parent 7f408e57ee
commit b17151eb16
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
1 changed files with 7 additions and 5 deletions

View File

@ -416,12 +416,14 @@ static void DrawThings(SDL_Renderer *renderer)
static void Draw(void) static void Draw(void)
{ {
SDL_Renderer *renderer = state->renderers[0]; SDL_Renderer *renderer = state->renderers[0];
if (renderer) { /* might be NULL if we're shutting down. */
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(renderer, 64, 0, 64, 255); SDL_SetRenderDrawColor(renderer, 64, 0, 64, 255);
SDL_RenderClear(renderer); SDL_RenderClear(renderer);
DrawThings(renderer); DrawThings(renderer);
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
} }
}
static void RepositionRowOfThings(const ThingType what, const float y) static void RepositionRowOfThings(const ThingType what, const float y)
{ {