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

This commit is contained in:
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,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)