Commit 52f561fc authored by wind2009's avatar wind2009 Committed by GitHub

Fix null pointer (#183)

parent 4769ca26
...@@ -1713,6 +1713,8 @@ namespace WindBot.Game.AI.Decks ...@@ -1713,6 +1713,8 @@ namespace WindBot.Game.AI.Decks
enemySetThisTurn.Add(card); enemySetThisTurn.Add(card);
} }
} }
if (card != null)
{
if (previousControler == 0) if (previousControler == 0)
{ {
if (previousLocation == (int)CardLocation.MonsterZone && currentLocation != (int)CardLocation.MonsterZone) if (previousLocation == (int)CardLocation.MonsterZone && currentLocation != (int)CardLocation.MonsterZone)
...@@ -1729,7 +1731,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1729,7 +1731,7 @@ namespace WindBot.Game.AI.Decks
{ {
ClientCard currentSolvingChain = Duel.GetCurrentSolvingChainCard(); ClientCard currentSolvingChain = Duel.GetCurrentSolvingChainCard();
if (currentLocation == (int)CardLocation.SpellZone && (currentSolvingChain == null || !currentSolvingChain.IsCode(CardId.AriasTheLabrynthButler)) if (currentLocation == (int)CardLocation.SpellZone && (currentSolvingChain == null || !currentSolvingChain.IsCode(CardId.AriasTheLabrynthButler))
&& card != null && (card.HasType(CardType.Trap) || card.IsCode(CardId.WelcomeLabrynth, CardId.BigWelcomeLabrynth)) && (card.HasType(CardType.Trap) || card.IsCode(CardId.WelcomeLabrynth, CardId.BigWelcomeLabrynth))
) )
{ {
Logger.DebugWriteLine("[setTrapThisTurn]set " + card.Name ?? "UnknowCard"); Logger.DebugWriteLine("[setTrapThisTurn]set " + card.Name ?? "UnknowCard");
...@@ -1749,6 +1751,7 @@ namespace WindBot.Game.AI.Decks ...@@ -1749,6 +1751,7 @@ namespace WindBot.Game.AI.Decks
} }
} }
} }
}
base.OnMove(card, previousControler, previousLocation, currentControler, currentLocation); base.OnMove(card, previousControler, previousLocation, currentControler, currentLocation);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment