fix crash when card defined is missing or invalid

these card should be replaced or create a custom card for adventure mode
Power Struggle, Necropolis of Azar
This commit is contained in:
Anthony Calosa
2024-10-08 16:25:52 +08:00
parent 57011c6cf5
commit af3ceb3348

View File

@@ -48,9 +48,14 @@ public class EffectData implements Serializable {
if(C != null)
startCards.add(C);
else {
PaperToken T = FModel.getMagicDb().getAllTokens().getToken(name);
if (T != null) startCards.add(T);
else System.err.print("Can not find card \"" + name + "\"\n");
try {
PaperToken T = FModel.getMagicDb().getAllTokens().getToken(name);
if (T != null) startCards.add(T);
else System.err.print("Can not find card/token \"" + name + "\"\n");
} catch (Exception e) {
//if it's not found probably the item is using funny cards and the users setting disabled non legal cards
System.err.print("Can not find card/token \"" + name + "\"\n");
}
}
}
}
@@ -65,9 +70,14 @@ public class EffectData implements Serializable {
if(C != null)
startCardsInCommandZone.add(C);
else {
PaperToken T = FModel.getMagicDb().getAllTokens().getToken(name);
if (T != null) startCardsInCommandZone.add(T);
else System.err.print("Can not find card \"" + name + "\"\n");
try {
PaperToken T = FModel.getMagicDb().getAllTokens().getToken(name);
if (T != null) startCardsInCommandZone.add(T);
else System.err.print("Can not find card/token \"" + name + "\"\n");
} catch (Exception e) {
//if it's not found probably the item is using funny cards and the users setting disabled non legal cards
System.err.print("Can not find card/token \"" + name + "\"\n");
}
}
}
}