Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed crash if conversion fails. Use ISO name for Latin-1
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 12, 2007
1 parent 6fa76ba commit a0b076d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/events/SDL_keyboard.c
Expand Up @@ -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";
Expand Down

0 comments on commit a0b076d

Please sign in to comment.