mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Prevent possible NPE in AI code.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user