From 579338e8d53894e3b48cb166d7a1401b2ebadc49 Mon Sep 17 00:00:00 2001 From: Jens Kreutschmann Date: Mon, 7 Oct 2019 19:59:57 +0200 Subject: [PATCH] Check actualCommand actually exists In case a helpfile is found, but the command is not existing this errors out, when trying to render the `Syntax` and `Aliases` header. --- commands/help.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/help.js b/commands/help.js index fcce176..161871c 100644 --- a/commands/help.js +++ b/commands/help.js @@ -45,10 +45,12 @@ function render(state, hfile) { if (hfile.command) { let actualCommand = state.CommandManager.get(hfile.command); - header += formatHeaderItem('Syntax', actualCommand.usage); + if (actualCommand) { + header += formatHeaderItem('Syntax', actualCommand.usage); - if (actualCommand.aliases && actualCommand.aliases.length > 0){ - header += formatHeaderItem('Aliases', actualCommand.aliases.join(', ')); + if (actualCommand.aliases && actualCommand.aliases.length > 0){ + header += formatHeaderItem('Aliases', actualCommand.aliases.join(', ')); + } } } else if (hfile.channel) { header += formatHeaderItem('Syntax', state.ChannelManager.get(hfile.channel).getUsage());