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

Commit

Permalink
Fix a crash caused by empty keyboard focus
Browse files Browse the repository at this point in the history
---
 src/events/SDL_keyboard.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
  • Loading branch information
jjgod committed Apr 20, 2010
1 parent 9d519f2 commit 3076346
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/events/SDL_keyboard.c
Expand Up @@ -813,7 +813,7 @@ SDL_SendKeyboardKey(int index, Uint8 state, SDL_scancode scancode)
event.key.keysym.sym = keyboard->keymap[scancode];
event.key.keysym.mod = modstate;
event.key.keysym.unicode = 0;
event.key.windowID = keyboard->focus->id;
event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
Expand All @@ -837,7 +837,7 @@ SDL_SendKeyboardText(int index, const char *text)
event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
event.text.which = (Uint8) index;
SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
event.text.windowID = keyboard->focus->id;
event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
posted = (SDL_PushEvent(&event) > 0);
}
return (posted);
Expand Down

0 comments on commit 3076346

Please sign in to comment.