summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Henriksen <LarsHenriksen@get2net.dk>2017-08-11 09:35:43 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-08-12 15:38:55 +0200
commit53db74ab343b5fc4c5e655b47e3886d58227ce07 (patch)
tree1a42719d942eec58806e11f1181e3b89c19fd75e /src
parent0df373f26a07b70b2705994fc19b76981d09deef (diff)
downloadcalcurse-53db74ab343b5fc4c5e655b47e3886d58227ce07.tar.gz
calcurse-53db74ab343b5fc4c5e655b47e3886d58227ce07.zip
Fix fatal error when using the help command
Check that an action is defined for the key. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src')
-rw-r--r--src/help.c11
1 files changed, 6 insertions, 5 deletions
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)) {