Fixed code for NPE handling with NPE
This commit is contained in:
parent
dcc955a816
commit
c534a45b73
1 changed files with 2 additions and 3 deletions
|
@ -84,11 +84,10 @@ 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)) {
|
||||||
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.");
|
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());
|
throw new NullPointerException("GetHelpText is null for comand /" + cmd.GetCommandPath());
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
sender.sendMessage(cmd.GetHelpText(alias));
|
sender.sendMessage(cmd.GetHelpText(alias));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in a new issue