Bladeren bron

Fixed NPE when skill is not in config

When a skill is not configured this would throw an NPE as the section is not found.

Found while trying to get information from an McMMOLevelUp event
Maxim Van de Wynckel 10 jaren geleden
bovenliggende
commit
f9879be439
1 gewijzigde bestanden met toevoegingen van 2 en 0 verwijderingen
  1. 2 0
      src/main/java/com/gmail/nossr50/config/Config.java

+ 2 - 0
src/main/java/com/gmail/nossr50/config/Config.java

@@ -451,6 +451,8 @@ public class Config extends AutoUpdateConfigLoader {
     public boolean getDoubleDropsDisabled(SkillType skill) {
     public boolean getDoubleDropsDisabled(SkillType skill) {
         String skillName = StringUtils.getCapitalized(skill.toString());
         String skillName = StringUtils.getCapitalized(skill.toString());
         ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
         ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
+        if (section == null)
+            return false;
         Set<String> keys = section.getKeys(false);
         Set<String> keys = section.getKeys(false);
         boolean disabled = true;
         boolean disabled = true;