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.
This commit is contained in:
@@ -4055,7 +4055,7 @@ bool SDL_GetWindowMouseGrab(SDL_Window *window)
|
|||||||
|
|
||||||
SDL_Window *SDL_GetGrabbedWindow(void)
|
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) {
|
(_this->grabbed_window->flags & (SDL_WINDOW_MOUSE_GRABBED | SDL_WINDOW_KEYBOARD_GRABBED)) != 0) {
|
||||||
return _this->grabbed_window;
|
return _this->grabbed_window;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user