mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-28 14:24:57 +00:00
video: Check video backend initialization when querying the grabbed window
SDL_GetGrabbedWindow() can be called when the video system is uninitialized, and, since there is no window parameter, _this must be checked for validity to avoid a segfault.
(cherry picked from commit be82f316c4)
This commit is contained in:
@@ -4069,7 +4069,7 @@ bool SDL_GetWindowMouseGrab(SDL_Window *window)
|
||||
|
||||
SDL_Window *SDL_GetGrabbedWindow(void)
|
||||
{
|
||||
if (_this->grabbed_window &&
|
||||
if (_this && _this->grabbed_window &&
|
||||
(_this->grabbed_window->flags & (SDL_WINDOW_MOUSE_GRABBED | SDL_WINDOW_KEYBOARD_GRABBED)) != 0) {
|
||||
return _this->grabbed_window;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user