SDL: Check nullptr before calling the windows message hook for WM_ENTERSIZEMOVE and WM_ENTERMENULOOP

From eb5ab220324ebef14a74f976c577bb20f0904133 Mon Sep 17 00:00:00 2001
From: WinterSquire <[EMAIL REDACTED]>
Date: Tue, 4 Feb 2025 12:46:17 +0800
Subject: [PATCH] Check nullptr before calling the windows message hook for
 WM_ENTERSIZEMOVE and WM_ENTERMENULOOP

---
 src/video/windows/SDL_windowsevents.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 64765dc53a2e2..947a05e4f4b00 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -1721,8 +1721,10 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
     case WM_ENTERSIZEMOVE:
     case WM_ENTERMENULOOP:
     {
-        if (!DispatchModalLoopMessageHook(&hwnd, &msg, &wParam, &lParam)) {
-            return 0;
+        if (g_WindowsMessageHook) {
+            if (!DispatchModalLoopMessageHook(&hwnd, &msg, &wParam, &lParam)) {
+                return 0;
+            }
         }
 
         ++data->in_modal_loop;