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,12 +632,14 @@ public class PlayerControllerAi extends PlayerController {
}
Card toSave = hostsa == null ? sa.getTargetCard() : hostsa.getTargetCard();
CardCollection threats = null;
if (toSave != null) {
if (combat.isBlocked(toSave)) {
threats = combat.getBlockers(toSave);
}
if (combat.isBlocking(toSave)) {
threats = combat.getAttackersBlockedBy(toSave);
}
}
if (threats != null) {
ComputerUtilCard.sortByEvaluateCreature(threats);
String s = ProtectAi.toProtectFrom(threats.get(0), sa);