Fixed code for NPE handling with NPE

This commit is contained in:
Norbi Peti 2016-11-12 01:12:42 +01:00
parent dcc955a816
commit c534a45b73

View file

@ -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) {