From b85be36d1cb96e0328b3f1dc9388288989d3b8e5 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 26 Oct 2015 22:03:04 +0000 Subject: Handle unknown keys more gracefully, return a string instead of NULL. --- key-string.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'key-string.c') diff --git a/key-string.c b/key-string.c index b6474c4f..88cd2a32 100644 --- a/key-string.c +++ b/key-string.c @@ -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, "", key); + return (out); + } /* Check for standard or control key. */ if (key >= 0 && key <= 32) { -- cgit v1.2.3