From 6fdea6572ca7701995cc8a9b7bf6d18dd8e9c2f9 Mon Sep 17 00:00:00 2001 From: Agetian Date: Thu, 13 Jul 2017 04:12:53 +0000 Subject: [PATCH] - Only add existing booster templates to the template map to avoid situations where the game would try to generate a non-existing booster pack and crash (e.g. unlocking a Starter 2000 set in quest mode). - Only show the "You receive the following bonus cards" window if there are bonus cards available from the booster template. --- forge-core/src/main/java/forge/card/CardEdition.java | 4 +++- .../src/main/java/forge/quest/QuestUtilUnlockSets.java | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/forge-core/src/main/java/forge/card/CardEdition.java b/forge-core/src/main/java/forge/card/CardEdition.java index aadfe8455dc..73a03818265 100644 --- a/forge-core/src/main/java/forge/card/CardEdition.java +++ b/forge-core/src/main/java/forge/card/CardEdition.java @@ -431,7 +431,9 @@ public final class CardEdition implements Comparable { // immutable public Map readAll() { Map map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); for(CardEdition ce : Collection.this) { - map.put(ce.getCode(), ce.getBoosterTemplate()); + if (ce.hasBoosterTemplate()) { + map.put(ce.getCode(), ce.getBoosterTemplate()); + } } return map; } diff --git a/forge-gui/src/main/java/forge/quest/QuestUtilUnlockSets.java b/forge-gui/src/main/java/forge/quest/QuestUtilUnlockSets.java index 7cfb8a36df9..c98678721c0 100644 --- a/forge-gui/src/main/java/forge/quest/QuestUtilUnlockSets.java +++ b/forge-gui/src/main/java/forge/quest/QuestUtilUnlockSets.java @@ -217,8 +217,11 @@ public class QuestUtilUnlockSets { cardsWon.addAll(booster.get()); } - qData.getCards().addAllCards(cardsWon); - GuiBase.getInterface().showCardList(unlockedSet.getName(), "You get the following bonus cards:", cardsWon); + if (!cardsWon.isEmpty()) { + qData.getCards().addAllCards(cardsWon); + GuiBase.getInterface().showCardList(unlockedSet.getName(), "You get the following bonus cards:", cardsWon); + } + qData.save(); } }