Give a better error when a subgroup is null.

This commit is contained in:
ElgarL 2012-08-31 21:47:35 +01:00
parent d588c3f271
commit cfe634e8f7
2 changed files with 10 additions and 5 deletions

View file

@ -195,3 +195,4 @@ v 2.0:
- Fix GlobalGroups not loading permission nodes. - Fix GlobalGroups not loading permission nodes.
- Fix an error with Logging set to 'OFF' triggering a cast exception. - Fix an error with Logging set to 'OFF' triggering a cast exception.
- No more null errors from corrupt config.yml's. - No more null errors from corrupt config.yml's.
- Give a better error when a subgroup is null.

View file

@ -861,6 +861,9 @@ public class WorldDataHolder {
*/ */
} else if (nodeData instanceof List) { } else if (nodeData instanceof List) {
for (Object o : ((List) nodeData)) { for (Object o : ((List) nodeData)) {
if (o == null) {
GroupManager.logger.warning("Invalid Subgroup data for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
} else {
Group subGrp = ph.getGroup(o.toString()); Group subGrp = ph.getGroup(o.toString());
if (subGrp != null) { if (subGrp != null) {
thisUser.addSubGroup(subGrp); thisUser.addSubGroup(subGrp);
@ -868,6 +871,7 @@ public class WorldDataHolder {
GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath());
} }
} }
}
} else if (nodeData instanceof String) { } else if (nodeData instanceof String) {
Group subGrp = ph.getGroup(nodeData.toString()); Group subGrp = ph.getGroup(nodeData.toString());
if (subGrp != null) { if (subGrp != null) {