From d5dac0ad27dae1ee040f8a64f03c3aab4d0437ac Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 16 Oct 2023 14:03:58 -0400 Subject: [PATCH] testaudio: Deal with a texture being unexpectedly NULL when scaling. This happens to work because our current textures are all 128x128, but in theory one shouldn't hit this case anyhow...right?! Reference Issue #8344. --- test/testaudio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/testaudio.c b/test/testaudio.c index 9813237da5..ab70d29349 100644 --- a/test/testaudio.c +++ b/test/testaudio.c @@ -359,9 +359,10 @@ static void DrawOneThing(SDL_Renderer *renderer, Thing *thing) if (thing->scale != 1.0f) { const float centerx = thing->rect.x + (thing->rect.w / 2); const float centery = thing->rect.y + (thing->rect.h / 2); - SDL_assert(thing->texture != NULL); - dst.w = thing->texture->w * thing->scale; - dst.h = thing->texture->h * thing->scale; + const int w = 0 && thing->texture ? thing->texture->w : 128; + const int h = 0 && thing->texture ? thing->texture->h : 128; + dst.w = w * thing->scale; + dst.h = h * thing->scale; dst.x = centerx - (dst.w / 2); dst.y = centery - (dst.h / 2); }