sdl2-compat: events: SDL_WaitEventTimeout can take a NULL event pointer, so don't crash.

From 169d27dfe744c2db1df6df61edc8baa75fe6841e Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 11 Nov 2024 21:20:50 -0500
Subject: [PATCH] events: SDL_WaitEventTimeout can take a NULL event pointer,
 so don't crash.

Fixes crashes in Lite XL ( https://github.com/lite-xl/lite-xl ).
---
 src/sdl2_compat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 8486498..84c6afb 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -1780,8 +1780,8 @@ SDL_DECLSPEC int SDLCALL
 SDL_WaitEventTimeout(SDL2_Event *event2, int timeout)
 {
     SDL_Event event3;
-    const int retval = SDL3_WaitEventTimeout(&event3, timeout);
-    if (retval == 1) {
+    const int retval = SDL3_WaitEventTimeout(event2 ? &event3 : NULL, timeout);
+    if ((retval == 1) && event2) {
         Event3to2(&event3, event2);
     }
     return retval;