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 9493e6974f
This commit is contained in:
Anonymous Maarten 2024-08-07 23:54:29 +02:00 committed by Anonymous Maarten
parent 125ce71379
commit 5cd6923298

View File

@ -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;
}