Fix a crash caused by empty keyboard focus
authorJjgod Jiang <gzjjgod@gmail.com>
Tue, 20 Apr 2010 07:16:42 -0700
changeset 443725e45611fa3d
parent 4436 d3c193100522
child 4439 ab63fdcf66af
Fix a crash caused by empty keyboard focus
---
src/events/SDL_keyboard.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
src/events/SDL_keyboard.c
     1.1 --- a/src/events/SDL_keyboard.c	Thu Apr 15 22:27:50 2010 -0700
     1.2 +++ b/src/events/SDL_keyboard.c	Tue Apr 20 07:16:42 2010 -0700
     1.3 @@ -813,7 +813,7 @@
     1.4          event.key.keysym.sym = keyboard->keymap[scancode];
     1.5          event.key.keysym.mod = modstate;
     1.6          event.key.keysym.unicode = 0;
     1.7 -        event.key.windowID = keyboard->focus->id;
     1.8 +        event.key.windowID = keyboard->focus ? keyboard->focus->id : 0;
     1.9          posted = (SDL_PushEvent(&event) > 0);
    1.10      }
    1.11      return (posted);
    1.12 @@ -837,7 +837,7 @@
    1.13          event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
    1.14          event.text.which = (Uint8) index;
    1.15          SDL_strlcpy(event.text.text, text, SDL_arraysize(event.text.text));
    1.16 -        event.text.windowID = keyboard->focus->id;
    1.17 +        event.text.windowID = keyboard->focus ? keyboard->focus->id : 0;
    1.18          posted = (SDL_PushEvent(&event) > 0);
    1.19      }
    1.20      return (posted);