Fix LivesCommand NPE

This commit is contained in:
Daniel Saukel 2016-12-03 13:05:18 +01:00
parent 5c7b466623
commit d900c80cf7

View File

@ -62,6 +62,10 @@ public class LivesCommand extends BRCommand {
}
DGamePlayer dPlayer = DGamePlayer.getByPlayer(player);
if (dPlayer == null && args.length == 1) {
MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
return;
}
DGroup dGroup = dPlayer != null ? dPlayer.getDGroup() : DGroup.getByName(args[1]);
if (dPlayer != null) {
MessageUtil.sendMessage(sender, DMessages.CMD_LIVES_PLAYER.getMessage(dPlayer.getName(), String.valueOf(dPlayer.getLives() == -1 ? "UNLIMITED" : dPlayer.getLives())));