From c534a45b7335bb1ddd098d85751034c412c7ad2d Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 12 Nov 2016 01:12:42 +0100 Subject: [PATCH] Fixed code for NPE handling with NPE --- src/main/java/buttondevteam/chat/commands/CommandCaller.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/buttondevteam/chat/commands/CommandCaller.java b/src/main/java/buttondevteam/chat/commands/CommandCaller.java index 1b29675..057fc2e 100644 --- a/src/main/java/buttondevteam/chat/commands/CommandCaller.java +++ b/src/main/java/buttondevteam/chat/commands/CommandCaller.java @@ -84,11 +84,10 @@ public class CommandCaller implements CommandExecutor { final String[] cmdargs = args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args; try { if (!cmd.OnCommand(sender, alias, cmdargs)) { - if(cmd.GetHelpText()==null) { + if (cmd.GetHelpText(alias) == null) { sender.sendMessage("Wrong usage, but there's no help text! Error is being reported to devs."); throw new NullPointerException("GetHelpText is null for comand /" + cmd.GetCommandPath()); - } - else + } else sender.sendMessage(cmd.GetHelpText(alias)); } } catch (Exception e) {