SDL: SDL_windowsopengl.c: WGL: Fixed null-pointer dereference crash (9e76f)

From 9e76f23561c54bb0ad9f7f63bc5635395ff059cb Mon Sep 17 00:00:00 2001
From: Wohlstand <[EMAIL REDACTED]>
Date: Sat, 3 Feb 2024 10:33:06 +0300
Subject: [PATCH] SDL_windowsopengl.c: WGL: Fixed null-pointer dereference
 crash

Fixes #8968

Fixed crash after https://github.com/libsdl-org/SDL/commit/594a79c2f9db21a11a76c012b2b1655a21fc8982

(cherry picked from commit a29f37c14abc2ae418e770353657e872a70d90b8)
---
 src/video/windows/SDL_windowsopengl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/video/windows/SDL_windowsopengl.c b/src/video/windows/SDL_windowsopengl.c
index feb1246665ba..bf8da76a8c8f 100644
--- a/src/video/windows/SDL_windowsopengl.c
+++ b/src/video/windows/SDL_windowsopengl.c
@@ -548,11 +548,11 @@ static int WIN_GL_ChoosePixelFormatARB(SDL_VideoDevice *_this, int *iAttribs, fl
             _this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs,
                                                     1, &pixel_format,
                                                     &matching);
-        }
 
-        /* Check whether we actually got an SRGB capable buffer */
-        _this->gl_data->wglGetPixelFormatAttribivARB(hdc, pixel_format, 0, 1, &qAttrib, &srgb);
-        _this->gl_config.framebuffer_srgb_capable = srgb;
+            /* Check whether we actually got an SRGB capable buffer */
+            _this->gl_data->wglGetPixelFormatAttribivARB(hdc, pixel_format, 0, 1, &qAttrib, &srgb);
+            _this->gl_config.framebuffer_srgb_capable = srgb;
+        }
 
         _this->gl_data->wglMakeCurrent(hdc, NULL);
         _this->gl_data->wglDeleteContext(hglrc);