From e9bcd254c3387871afbbff2fa200798b0ffc0ab4 Mon Sep 17 00:00:00 2001 From: Agetian Date: Thu, 29 Nov 2018 16:17:33 +0300 Subject: [PATCH] - NPE guard. --- .../src/main/java/forge/ai/ability/MustBlockAi.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/forge-ai/src/main/java/forge/ai/ability/MustBlockAi.java b/forge-ai/src/main/java/forge/ai/ability/MustBlockAi.java index 5774856259e..c29ddc1b72c 100644 --- a/forge-ai/src/main/java/forge/ai/ability/MustBlockAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/MustBlockAi.java @@ -107,11 +107,13 @@ public class MustBlockAi extends SpellAbilityAi { if (source.hasKeyword(Keyword.PROVOKE) && blocker.isTapped()) { // Don't provoke if the attack is potentially lethal Combat combat = ai.getGame().getCombat(); - Player defender = combat.getDefenderPlayerByAttacker(source); - if (combat != null && combat.getAttackingPlayer().equals(ai) - && defender.canLoseLife() && !defender.cantLoseForZeroOrLessLife() - && ComputerUtilCombat.lifeThatWouldRemain(defender, combat) <= 0) { - return false; + if (combat != null) { + Player defender = combat.getDefenderPlayerByAttacker(source); + if (defender != null && combat.getAttackingPlayer().equals(ai) + && defender.canLoseLife() && !defender.cantLoseForZeroOrLessLife() + && ComputerUtilCombat.lifeThatWouldRemain(defender, combat) <= 0) { + return false; + } } }