Fixed NPE with an NPE (#51)
From my phone. :P Also it's a more descriptive NPE.
This commit is contained in:
parent
795eacf38d
commit
dcc955a816
1 changed files with 100 additions and 94 deletions
|
@ -83,8 +83,14 @@ public class CommandCaller implements CommandExecutor {
|
||||||
}
|
}
|
||||||
final String[] cmdargs = args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args;
|
final String[] cmdargs = args.length > 0 ? Arrays.copyOfRange(args, args.length - argc, args.length) : args;
|
||||||
try {
|
try {
|
||||||
if (!cmd.OnCommand(sender, alias, cmdargs))
|
if (!cmd.OnCommand(sender, alias, cmdargs)) {
|
||||||
sender.sendMessage(cmd.GetHelpText(alias));
|
if(cmd.GetHelpText()==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
|
||||||
|
sender.sendMessage(cmd.GetHelpText(alias));
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
TBMCCoreAPI.SendException("Failed to execute command /" + cmd.GetCommandPath() + " with arguments "
|
TBMCCoreAPI.SendException("Failed to execute command /" + cmd.GetCommandPath() + " with arguments "
|
||||||
+ Arrays.toString(cmdargs), e);
|
+ Arrays.toString(cmdargs), e);
|
||||||
|
|
Loading…
Reference in a new issue