diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-10-26 22:03:05 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-10-26 22:03:05 +0000 |
commit | c1486dad503c38da34b70c9d2cf81ec9a23baa57 (patch) | |
tree | 3609b33a058329a3c898f66165a41ec15eba69c9 /usr.bin/tmux/key-string.c | |
parent | b7484af053b0567d0c82712db3ddefcc04a19da0 (diff) |
Handle unknown keys more gracefully, return a string instead of NULL.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index b8e68b298de..80f7396c018 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.26 2015/04/19 21:34:21 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.27 2015/10/26 22:03:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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) { |