mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-27 05:43:29 +08:00
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:
parent
125ce71379
commit
5cd6923298
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user