Fixed NPE

This commit is contained in:
Oleg Agafonov 2023-04-15 14:13:51 +04:00
parent c025349791
commit d6506657d6

View file

@ -219,10 +219,22 @@ public class TargetPermanentOrPlayer extends TargetImpl {
Permanent permanent = game.getPermanent(targetId); Permanent permanent = game.getPermanent(targetId);
if (permanent != null) { if (permanent != null) {
sb.append(permanent.getLogName()).append(' '); sb.append(permanent.getLogName()).append(' ');
} else { continue;
Player player = game.getPlayer(targetId);
sb.append(player.getLogName()).append(' ');
} }
Player player = game.getPlayer(targetId);
if (player != null) {
sb.append(player.getLogName()).append(' ');
continue;
}
MageObject object = game.getObject(targetId);
if (object != null) {
sb.append(object.getLogName()).append(' ');
continue;
}
sb.append("ERROR");
} }
return sb.toString().trim(); return sb.toString().trim();
} }