Fixed crash if conversion fails. Use ISO name for Latin-1
authorSam Lantinga <slouken@libsdl.org>
Sun, 12 Aug 2007 05:48:51 +0000
changeset 222922342048bcb8
parent 2228 bb67fd5ccfdb
child 2230 9b7d29d2432b
Fixed crash if conversion fails. Use ISO name for Latin-1
src/events/SDL_keyboard.c
     1.1 --- a/src/events/SDL_keyboard.c	Sun Aug 12 00:01:41 2007 +0000
     1.2 +++ b/src/events/SDL_keyboard.c	Sun Aug 12 05:48:51 2007 +0000
     1.3 @@ -448,9 +448,11 @@
     1.4              char *cvt;
     1.5              temp[0] = (char) key;
     1.6              temp[1] = '\0';
     1.7 -            cvt = SDL_iconv_string("UTF-8", "LATIN1", temp, 1);
     1.8 -            SDL_strlcpy(temp, cvt, SDL_arraysize(temp));
     1.9 -            SDL_free(cvt);
    1.10 +            cvt = SDL_iconv_string("UTF-8", "ISO-8859-1", temp, 1);
    1.11 +            if (cvt) {
    1.12 +                SDL_strlcpy(temp, cvt, SDL_arraysize(temp));
    1.13 +                SDL_free(cvt);
    1.14 +            }
    1.15              keyname = temp;
    1.16          } else {
    1.17              keyname = "unknown key";