Fix null reference exception.
authorWim Looman <ghostunderscore@gmail.com>
Fri, 03 Feb 2012 23:08:48 +1300
changeset 6300 82f95e6af4cd
parent 6299 3809b2eee787
child 6301 e8a69c5378e7
Fix null reference exception. Occurred when using relative mouse mode without a focused window.
src/events/SDL_mouse.c
--- a/src/events/SDL_mouse.c	Mon Feb 20 23:54:33 2012 -0500
+++ b/src/events/SDL_mouse.c	Fri Feb 03 23:08:48 2012 +1300
@@ -323,7 +323,7 @@
     /* 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);
     }