Fix null reference exception.

Occurred when using relative mouse mode without a focused window.
This commit is contained in:
Wim Looman 2012-02-03 23:08:48 +13:00
parent 721ac5f4d8
commit 0da1c5b3ae

View file

@ -323,7 +323,7 @@ SDL_SetRelativeMouseMode(SDL_bool enabled)
/* Set the relative mode */
mouse->relative_mode = enabled;
if (!enabled) {
if (!enabled && mouse->focus) {
/* Restore the expected mouse position */
SDL_WarpMouseInWindow(mouse->focus, mouse->x, mouse->y);
}