- Fixed a crash when loading a game state with a misspelled card name (will now report the card name in the console instead of hard-crashing).

This commit is contained in:
Agetian
2017-07-30 11:14:32 +00:00
parent bbcf7b638f
commit 56d79f36dc

View File

@@ -510,6 +510,11 @@ public abstract class GameState {
c = CardFactory.makeOneToken(CardFactory.TokenInfo.fromString(tokenStr), player); c = CardFactory.makeOneToken(CardFactory.TokenInfo.fromString(tokenStr), player);
} else { } else {
PaperCard pc = StaticData.instance().getCommonCards().getCard(cardinfo[0], setCode); PaperCard pc = StaticData.instance().getCommonCards().getCard(cardinfo[0], setCode);
if (pc == null) {
System.err.println("ERROR: Tried to create a non-existent card named " + cardinfo[0] + " (set: " + (setCode == null ? "any" : setCode) + ") when loading game state!");
continue;
}
c = Card.fromPaperCard(pc, player); c = Card.fromPaperCard(pc, player);
if (setCode != null) { if (setCode != null) {
hasSetCurSet = true; hasSetCurSet = true;