From a0b076dc5303bc6f77b12041de68d4034ae97681 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 12 Aug 2007 05:48:51 +0000 Subject: [PATCH] Fixed crash if conversion fails. Use ISO name for Latin-1 --- src/events/SDL_keyboard.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 87db81bdc..0711593e7 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -448,9 +448,11 @@ SDL_GetKeyName(SDLKey key) char *cvt; temp[0] = (char) key; temp[1] = '\0'; - cvt = SDL_iconv_string("UTF-8", "LATIN1", temp, 1); - SDL_strlcpy(temp, cvt, SDL_arraysize(temp)); - SDL_free(cvt); + cvt = SDL_iconv_string("UTF-8", "ISO-8859-1", temp, 1); + if (cvt) { + SDL_strlcpy(temp, cvt, SDL_arraysize(temp)); + SDL_free(cvt); + } keyname = temp; } else { keyname = "unknown key";