From a2cca4cb5a01f70c39c23315322c7d74e7faf908 Mon Sep 17 00:00:00 2001 From: Agetian Date: Tue, 27 Dec 2016 19:09:32 +0000 Subject: [PATCH] - Do not crash when an unsupported card is found in a quest save, instead warn about it in the log and do not include the card in the pool (which eventually removes it from the save file). - Might need to do something about CNS Conspiracies and other substandard cards enering the quest pool (e.g. from reward booster packs), which tended to "corrupt" the quest save by introducing cards into the pool which can't be loaded later (and used to crash). --- forge-gui/src/main/java/forge/quest/io/QuestDataIO.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/forge-gui/src/main/java/forge/quest/io/QuestDataIO.java b/forge-gui/src/main/java/forge/quest/io/QuestDataIO.java index 55bd111e328..3ddacf50b53 100644 --- a/forge-gui/src/main/java/forge/quest/io/QuestDataIO.java +++ b/forge-gui/src/main/java/forge/quest/io/QuestDataIO.java @@ -733,7 +733,10 @@ public class QuestDataIO { if ("string".equals(nodename)) { pool.add(FModel.getMagicDb().getCommonCards().getCard(reader.getValue())); } else if ("card".equals(nodename)) { // new format - pool.add(this.readCardPrinted(reader), cnt); + PaperCard pc = this.readCardPrinted(reader); + if (pc != null) { + pool.add(pc, cnt); + } } reader.moveUp(); } @@ -899,7 +902,7 @@ public class QuestDataIO { final boolean foil = "1".equals(reader.getAttribute("foil")); PaperCard card = FModel.getMagicDb().getOrLoadCommonCard(name, set, index, foil); if (null == card) { - throw new RuntimeException("Unsupported card found in quest save: " + name + " from edition " + set); + System.err.println("Warning: Unsupported card found in quest save: " + name + " from edition " + set +". It will be removed from the quest save."); } return card; }