SDL: Assert a valid window pointer instead of dismissing an invalid pointer

From 5cd69232982b043dc3272ed338145a9d8ac32d8b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 7 Aug 2024 23:54:29 +0200
Subject: [PATCH] Assert a valid window pointer instead of dismissing an
 invalid pointer

Throwing an assertion and breaking the program should allow developers
to catch wrong usage of the API faster.

Follow-up of 9493e6974f70a906950c9d8196c9a9982300f261
---
 src/events/SDL_windowevents.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c
index 0dd7e4a0f74f4..529be7f60381b 100644
--- a/src/events/SDL_windowevents.c
+++ b/src/events/SDL_windowevents.c
@@ -43,9 +43,11 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
 {
     int posted;
 
-    if (!SDL_ObjectValid(window, SDL_OBJECT_TYPE_WINDOW)) {
+    if (!window) {
         return 0;
     }
+    SDL_assert(SDL_ObjectValid(window, SDL_OBJECT_TYPE_WINDOW));
+
     if (window->is_destroying && windowevent != SDL_EVENT_WINDOW_DESTROYED) {
         return 0;
     }