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 2229 22342048bcb8
parent 2228 bb67fd5ccfdb
child 2230 9b7d29d2432b
Fixed crash if conversion fails. Use ISO name for Latin-1
src/events/SDL_keyboard.c
--- 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";