fixed some NPEs

This commit is contained in:
BetaSteward 2011-08-24 21:42:06 -04:00
parent d85bd073c7
commit 5023d13525
3 changed files with 7 additions and 4 deletions

View file

@ -689,8 +689,11 @@ public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements
UUID opponentId = game.getCombat().getDefenders().iterator().next();
for (UUID attackerId: combat.getAttackers()) {
this.declareAttacker(attackerId, opponentId, game);
if (logger.isDebugEnabled())
logger.debug("attacking with:" + game.getPermanent(attackerId).getName());
if (logger.isDebugEnabled()) {
Permanent p = game.getPermanent(attackerId);
if (p != null)
logger.debug("attacking with:" + p.getName());
}
}
}
}

View file

@ -219,7 +219,7 @@ public class TableManager {
controllers.remove(tableId);
tables.remove(tableId);
GamesRoomManager.getInstance().removeTable(tableId);
if (table.getMatch().getGame() != null)
if (table.getMatch() != null && table.getMatch().getGame() != null)
table.getMatch().getGame().end();
}
}

View file

@ -52,7 +52,7 @@ public class EnchantedCondition implements Condition {
if (permanent != null) {
for (UUID uuid : permanent.getAttachments()) {
Permanent attached = game.getBattlefield().getPermanent(uuid);
if (attached.getCardType().contains(CardType.ENCHANTMENT)) {
if (attached != null && attached.getCardType().contains(CardType.ENCHANTMENT)) {
return true;
}
}