diff options
author | Sam Lantinga <slouken@libsdl.org> | 2010-01-21 16:11:55 +0000 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2010-01-21 16:11:55 +0000 |
commit | 355a34efece3d03360ccbac1fda59c3f5434ff90 (patch) | |
tree | 5df97ac6890ae7735739df494faff2eefd6fe642 | |
parent | 8d335a444983b943deb3160c3b548e4378e6c1b6 (diff) |
Fixed crash when there was no mouse focus for some reason (iPhone bug?)
-rw-r--r-- | src/events/SDL_mouse.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 5fdfee7b62..4835653349 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -373,7 +373,7 @@ SDL_SendProximity(int id, int x, int y, int type) event.proximity.cursor = mouse->current_end; event.proximity.type = type; /* FIXME: is this right? */ - event.proximity.windowID = mouse->focus->id; + event.proximity.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); if (type == SDL_PROXIMITYIN) { mouse->proximity = SDL_TRUE; @@ -479,7 +479,7 @@ SDL_SendMouseMotion(int id, int relative, int x, int y, int pressure) event.motion.cursor = mouse->current_end; event.motion.xrel = xrel; event.motion.yrel = yrel; - event.motion.windowID = mouse->focus->id; + event.motion.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } mouse->last_x = mouse->x; @@ -532,7 +532,7 @@ SDL_SendMouseButton(int id, Uint8 state, Uint8 button) event.button.button = button; event.button.x = mouse->x; event.button.y = mouse->y; - event.button.windowID = mouse->focus->id; + event.button.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } return posted; @@ -556,7 +556,7 @@ SDL_SendMouseWheel(int index, int x, int y) event.wheel.which = (Uint8) index; event.wheel.x = x; event.wheel.y = y; - event.wheel.windowID = mouse->focus->id; + event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } return posted; |