Handle unknown keys more gracefully, return a string instead of NULL.

This commit is contained in:
nicm
2015-10-26 22:03:04 +00:00
parent a22fe33aa0
commit b85be36d1c
2 changed files with 4 additions and 10 deletions

View File

@ -238,8 +238,10 @@ key_string_lookup_key(int key)
}
/* Invalid keys are errors. */
if (key == 127 || key > 255)
return (NULL);
if (key == 127 || key > 255) {
snprintf(out, sizeof out, "<INVALID#%04x>", key);
return (out);
}
/* Check for standard or control key. */
if (key >= 0 && key <= 32) {