Prevent NPE

This commit is contained in:
Anthony Calosa
2019-09-19 23:22:59 +08:00
parent 913d108f69
commit 73f3a5ff85
2 changed files with 5 additions and 1 deletions

View File

@@ -66,6 +66,8 @@ public class ComputerUtilMana {
// Does not check if mana sources can be used right now, just checks for potential chance.
public static boolean hasEnoughManaSourcesToCast(final SpellAbility sa, final Player ai) {
if(ai == null || sa == null)
return false;
sa.setActivatingPlayer(ai);
return payManaCost(sa, ai, true, 0, false);
}

View File

@@ -186,7 +186,9 @@ public class MatchController extends AbstractGuiGame {
final PlayerView p = gameView.getPlayerTurn();
final PhaseType ph = gameView.getPhase();
final PhaseLabel lbl = view.getPlayerPanel(p).getPhaseIndicator().getLabel(ph);
PhaseLabel lbl = null;
if(p != null && ph != null)
lbl = view.getPlayerPanel(p).getPhaseIndicator().getLabel(ph);
view.resetAllPhaseButtons();
if (lbl != null) {