Skip to content

Commit

Permalink
Fixed NPE when saving ConfigMaps with ConfigManager
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam committed Jun 21, 2020
1 parent 6890589 commit e600d88
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/redempt/redlib/configmanager/ConfigField.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public void save(Object object, ConfigurationSection config) {
try {
if (path.endsWith(".*")) {
ConfigMap<?> map = (ConfigMap<?>) field.get(object);
String name = path.substring(0, path.length() - 2);
ConfigurationSection section = config.getConfigurationSection(name);
section = section == null ? config.createSection(name) : section;
map.section = section;
map.init(manager);
map.save();
return;
Expand Down
7 changes: 7 additions & 0 deletions src/redempt/redlib/configmanager/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,11 @@ public ConfigManager save() {
return this;
}

/**
* @return The configuration this ConfigManager is loading from and saving to
*/
public YamlConfiguration getConfig() {
return config;
}

}

0 comments on commit e600d88

Please sign in to comment.