Prevent possible NPE in AI code.

This commit is contained in:
elcnesh
2015-03-20 15:26:53 +00:00
parent 939fe43e7e
commit 963b415e65

View File

@@ -632,11 +632,13 @@ public class PlayerControllerAi extends PlayerController {
} }
Card toSave = hostsa == null ? sa.getTargetCard() : hostsa.getTargetCard(); Card toSave = hostsa == null ? sa.getTargetCard() : hostsa.getTargetCard();
CardCollection threats = null; CardCollection threats = null;
if (combat.isBlocked(toSave)) { if (toSave != null) {
threats = combat.getBlockers(toSave); if (combat.isBlocked(toSave)) {
} threats = combat.getBlockers(toSave);
if (combat.isBlocking(toSave)) { }
threats = combat.getAttackersBlockedBy(toSave); if (combat.isBlocking(toSave)) {
threats = combat.getAttackersBlockedBy(toSave);
}
} }
if (threats != null) { if (threats != null) {
ComputerUtilCard.sortByEvaluateCreature(threats); ComputerUtilCard.sortByEvaluateCreature(threats);