Pārlūkot izejas kodu

Do not attempt to load an empty treasure config

NuclearW 12 gadi atpakaļ
vecāks
revīzija
e3e4cf9884

+ 8 - 3
src/main/java/com/gmail/nossr50/config/treasure/TreasureConfig.java

@@ -52,6 +52,11 @@ public class TreasureConfig extends ConfigLoader {
     protected void loadKeys() {
     protected void loadKeys() {
         Map<String, Treasure> treasures = new HashMap<String, Treasure>();
         Map<String, Treasure> treasures = new HashMap<String, Treasure>();
         ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
         ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
+
+        if (treasureSection == null) {
+            return;
+        }
+
         Set<String> treasureConfigSet = treasureSection.getKeys(false);
         Set<String> treasureConfigSet = treasureSection.getKeys(false);
 
 
         for (String treasureName : treasureConfigSet) {
         for (String treasureName : treasureConfigSet) {
@@ -211,14 +216,14 @@ public class TreasureConfig extends ConfigLoader {
             Treasure treasure = nextEntry.getValue();
             Treasure treasure = nextEntry.getValue();
 
 
             if (treasure instanceof FishingTreasure) {
             if (treasure instanceof FishingTreasure) {
-                if (!fishingTreasures.contains(treasureKey)) {
+                if (fishingTreasures == null || !fishingTreasures.contains(treasureKey)) {
                     continue;
                     continue;
                 }
                 }
 
 
                 fishingRewards.add((FishingTreasure) treasure);
                 fishingRewards.add((FishingTreasure) treasure);
             }
             }
             else if (treasure instanceof HylianTreasure) {
             else if (treasure instanceof HylianTreasure) {
-                if (!hylianTreasures.contains(treasureKey)) {
+                if (hylianTreasures == null || !hylianTreasures.contains(treasureKey)) {
                     continue;
                     continue;
                 }
                 }
 
 
@@ -237,7 +242,7 @@ public class TreasureConfig extends ConfigLoader {
                 }
                 }
             }
             }
             else if (treasure instanceof ExcavationTreasure) {
             else if (treasure instanceof ExcavationTreasure) {
-                if (!excavationTreasures.contains(treasureKey)) {
+                if (excavationTreasures == null || !excavationTreasures.contains(treasureKey)) {
                     continue;
                     continue;
                 }
                 }