Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Fixed crash if conversion fails. Use ISO name for Latin-1

  • Loading branch information
slouken committed Aug 12, 2007
1 parent 6fa76ba commit a0b076dc5303bc6f77b12041de68d4034ae97681
Showing with 5 additions and 3 deletions.
  1. +5 −3 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";

0 comments on commit a0b076d

Please sign in to comment.