From 53db74ab343b5fc4c5e655b47e3886d58227ce07 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Fri, 11 Aug 2017 09:35:43 +0200 Subject: Fix fatal error when using the help command Check that an action is defined for the key. Signed-off-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/help.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/help.c b/src/help.c index e4eed9c..62b6476 100644 --- a/src/help.c +++ b/src/help.c @@ -103,13 +103,14 @@ int display_help(const char *topic) asprintf(&path, "%s/%s.txt", basedir, topic); - if (!io_file_exists(path) && keys_str2int(topic) > 0 && - keys_get_action(keys_str2int(topic)) > 0) { + if (!io_file_exists(path)) { int ch = keys_str2int(topic); enum key action = keys_get_action(ch); - topic = keys_get_label(action); - mem_free(path); - asprintf(&path, "%s/%s.txt", basedir, topic); + if (ch > 0 && action > 0 && action != KEY_UNDEF) { + topic = keys_get_label(action); + mem_free(path); + asprintf(&path, "%s/%s.txt", basedir, topic); + } } if (!io_file_exists(path)) { -- cgit v1.2.3-70-g09d2