changeset 2229:22342048bcb8

Fixed crash if conversion fails. Use ISO name for Latin-1
author Sam Lantinga <slouken@libsdl.org>
date Sun, 12 Aug 2007 05:48:51 +0000
parents bb67fd5ccfdb
children 9b7d29d2432b
files src/events/SDL_keyboard.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Sun Aug 12 00:01:41 2007 +0000
+++ b/src/events/SDL_keyboard.c	Sun Aug 12 05:48:51 2007 +0000
@@ -448,9 +448,11 @@
             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";