SDL_image: Refactor error handling for GIF frame decoding to return false in either case

From feeb9ee68c61a55ddcbbb401abce452df59ba144 Mon Sep 17 00:00:00 2001
From: Xen <[EMAIL REDACTED]>
Date: Sat, 18 Oct 2025 04:59:40 -0700
Subject: [PATCH] Refactor error handling for GIF frame decoding to return
 false in either case

---
 src/IMG_gif.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/IMG_gif.c b/src/IMG_gif.c
index 60d1f4a7..86f46e95 100644
--- a/src/IMG_gif.c
+++ b/src/IMG_gif.c
@@ -891,16 +891,18 @@ static bool IMG_AnimationDecoderGetNextFrame_Internal(IMG_AnimationDecoder *deco
                               BitSet(ctx->buf[8], INTERLACE), 0, &ctx->state);
         }
 
-        if (!image) {
-            // Incorrect animation is harder to detect than a direct failure,
-            // so it's better to fail than try to animate a GIF without a,
-            // full set of frames it has in the file.
-
-            // Only set the error if ReadImage did not do it.
-            if (SDL_GetError()[0] == '\0') {
-                return SDL_SetError("Failed to decode frame.");
-            }
-        }
+      if (!image) {
+          // Incorrect animation is harder to detect than a direct failure,
+          // so it's better to fail than try to animate a GIF without a,
+          // full set of frames it has in the file.
+
+          // Only set the error if ReadImage did not do it.
+          if (SDL_GetError()[0] == '\0') {
+              return SDL_SetError("Failed to decode frame.");
+          }
+
+          return false;
+      }
 
         /* Composite the frame onto the canvas */
         SDL_Rect dest = { left, top, width, height };