Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crash when there was no mouse focus for some reason (iPhone bug?)
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 21, 2010
1 parent d665aaf commit 8991054
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/events/SDL_mouse.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 8991054

Please sign in to comment.