Catch NullPointerErrors generated by blank permission nodes.

This commit is contained in:
ElgarL 2012-01-14 15:48:55 +00:00
parent 768c92e5bf
commit d0e5685ac0
2 changed files with 14 additions and 3 deletions

View File

@ -99,4 +99,5 @@ v 1.8:
- Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit. - Fix 'manucheckp' to correctly report if a permission is available from GroupManager or Bukkit.
- Changed over to a reflection method for populating superperms as Bukkit lags when you handle permissions one at a time. - Changed over to a reflection method for populating superperms as Bukkit lags when you handle permissions one at a time.
- Major, MAJOR changes to support partial/full world mirroring. - Major, MAJOR changes to support partial/full world mirroring.
You can now mirror groups.yml, users.yml or both files between different worlds. You can now mirror groups.yml, users.yml or both files between different worlds.
- Catch NullPointerErrors generated by blank permission nodes.

View File

@ -470,7 +470,12 @@ public class WorldDataHolder {
} }
if (thisGroupNode.get("permissions") instanceof List) { if (thisGroupNode.get("permissions") instanceof List) {
for (Object o : ((List) thisGroupNode.get("permissions"))) { for (Object o : ((List) thisGroupNode.get("permissions"))) {
thisGrp.addPermission(o.toString()); try {
thisGrp.addPermission(o.toString());
} catch (NullPointerException e) {
// Ignore this entry as it's null.
//throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath());
}
} }
} else if (thisGroupNode.get("permissions") instanceof String) { } else if (thisGroupNode.get("permissions") instanceof String) {
thisGrp.addPermission((String) thisGroupNode.get("permissions")); thisGrp.addPermission((String) thisGroupNode.get("permissions"));
@ -582,7 +587,12 @@ public class WorldDataHolder {
thisUser.addPermission(o.toString()); thisUser.addPermission(o.toString());
} }
} else if (thisUserNode.get("permissions") instanceof String) { } else if (thisUserNode.get("permissions") instanceof String) {
thisUser.addPermission(thisUserNode.get("permissions").toString()); try {
thisUser.addPermission(thisUserNode.get("permissions").toString());
} catch (NullPointerException e) {
// Ignore this entry as it's null.
//throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath());
}
} }
//SUBGROUPS LOADING //SUBGROUPS LOADING