src/events/SDL_keyboard.c
changeset 6983 b72f56ab9867
parent 6885 700f1b25f77f
child 7191 75360622e65f
     1.1 --- a/src/events/SDL_keyboard.c	Fri Mar 08 16:27:05 2013 -0800
     1.2 +++ b/src/events/SDL_keyboard.c	Fri Mar 08 23:04:53 2013 -0800
     1.3 @@ -861,7 +861,7 @@
     1.4  {
     1.5      SDL_Keyboard *keyboard = &SDL_keyboard;
     1.6      
     1.7 -    if (scancode<SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
     1.8 +    if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
     1.9            SDL_InvalidParamError("scancode");
    1.10            return 0;
    1.11      }
    1.12 @@ -887,8 +887,13 @@
    1.13  const char *
    1.14  SDL_GetScancodeName(SDL_Scancode scancode)
    1.15  {
    1.16 -    const char *name = SDL_scancode_names[scancode];
    1.17 +    const char *name;
    1.18 +    if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
    1.19 +          SDL_InvalidParamError("scancode");
    1.20 +          return "";    
    1.21 +    }
    1.22  
    1.23 +    name = SDL_scancode_names[scancode];
    1.24      if (name)
    1.25          return name;
    1.26      else