- Better fix for BoosterGenerator NPE

This commit is contained in:
Sol
2014-03-29 16:31:54 +00:00
parent f58e85396c
commit bebf1be6db

View File

@@ -61,9 +61,9 @@ public class BoosterGenerator {
List<PrintSheet> sheetsUsed = new ArrayList<PrintSheet>();
CardEdition edition = StaticData.instance().getEditions().get(template.getEdition());
boolean hasFoil = edition != null && MyRandom.getRandom().nextDouble() < edition.getFoilChanceInBooster() && edition.getFoilType() != FoilType.NOT_SUPPORTED;
boolean hasFoil = edition != null && !template.getSlots().isEmpty() && MyRandom.getRandom().nextDouble() < edition.getFoilChanceInBooster() && edition.getFoilType() != FoilType.NOT_SUPPORTED;
boolean foilAtEndOfPack = hasFoil && edition.getFoilAlwaysInCommonSlot();
String foilSlot = (template.getSlots().isEmpty() || !hasFoil) ? null : foilAtEndOfPack ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey();
String foilSlot = !hasFoil ? null : foilAtEndOfPack ? BoosterSlots.COMMON : Aggregates.random(template.getSlots()).getKey();
for(Pair<String, Integer> slot : template.getSlots()) {
String slotType = slot.getLeft(); // add expansion symbol here?