*Fix potential NPE in Commander deck conformance check.

This commit is contained in:
Hellfish
2013-04-23 18:43:19 +00:00
parent f5ac535af3
commit deeba62794

View File

@@ -170,20 +170,23 @@ public enum DeckFormat {
}
}
}
for(Entry<CardPrinted, Integer> cp : deck.get(DeckSection.Sideboard)) {
if(!cp.getKey().getRules().getColorIdentity().hasNoColorsExcept(cmdCI.getColor()))
{
erroneousCI.add(cp.getKey());
}
if(cp.getKey().getRules().getType().isLand())
{
for(String key : Constant.Color.COLOR_TO_BASIC_LAND_TYPE_MAP.keySet())
if(deck.get(DeckSection.Sideboard) != null)
{
for(Entry<CardPrinted, Integer> cp : deck.get(DeckSection.Sideboard)) {
if(!cp.getKey().getRules().getColorIdentity().hasNoColorsExcept(cmdCI.getColor()))
{
if(!cmdCI.hasAnyColor(MagicColor.fromName(key)))
erroneousCI.add(cp.getKey());
}
if(cp.getKey().getRules().getType().isLand())
{
for(String key : Constant.Color.COLOR_TO_BASIC_LAND_TYPE_MAP.keySet())
{
if(cp.getKey().getRules().getType().subTypeContains(Constant.Color.COLOR_TO_BASIC_LAND_TYPE_MAP.get(key)))
if(!cmdCI.hasAnyColor(MagicColor.fromName(key)))
{
erroneousCI.add(cp.getKey());
if(cp.getKey().getRules().getType().subTypeContains(Constant.Color.COLOR_TO_BASIC_LAND_TYPE_MAP.get(key)))
{
erroneousCI.add(cp.getKey());
}
}
}
}