SDL_image: Fix regression (segfault) in LBM image loading (15b69)

From 15b699e48943159a74d580897c2f230cfbfd3a25 Mon Sep 17 00:00:00 2001
From: Ankith <[EMAIL REDACTED]>
Date: Sun, 17 Dec 2023 20:06:07 +0530
Subject: [PATCH] Fix regression (segfault) in LBM image loading

(cherry picked from commit a38dd1180ceb23fc076de89fce3b4c924d140fbd)
---
 src/IMG_lbm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/IMG_lbm.c b/src/IMG_lbm.c
index b165fb08..b0a0fb36 100644
--- a/src/IMG_lbm.c
+++ b/src/IMG_lbm.c
@@ -259,11 +259,9 @@ SDL_Surface *IMG_LoadLBM_RW( SDL_RWops *src )
           format = SDL_PIXELFORMAT_BGR24;
 #endif
        }
-       if (nbplanes == 24 || flagHAM == 1) {
-          if ((Image = SDL_CreateRGBSurfaceWithFormat(0, width, bmhd.h, 0, format)) == NULL ){
-             goto done;
-          }
-       }
+        if ((Image = SDL_CreateRGBSurfaceWithFormat(0, width, bmhd.h, 0, format)) == NULL){
+            goto done;
+        }
     }
 
     if ( bmhd.mask & 2 )               /* There is a transparent color */