fix an NPE, order matters!

This commit is contained in:
Brian 2012-06-07 21:17:02 -04:00
parent cb06e2cb1e
commit dd2ec4c157
2 changed files with 7 additions and 8 deletions

Binary file not shown.

View File

@ -792,9 +792,13 @@ public class ArenaListener
ArenaClass oldAC = arena.getArenaPlayer(p).getArenaClass();
ArenaClass newAC = arena.getClasses().get(className);
// If they picked the same sign, don't do anything
if (oldAC.equals(newAC)) {
return;
// If they already had a class, make sure to change the "in use" in the Class Limit Manager
if (oldAC != null) {
// If they picked the same sign, don't do anything
if (oldAC.equals(newAC)) {
return;
}
classLimits.playerChangedClass(oldAC);
}
// If they can not join the class, deny them
@ -803,11 +807,6 @@ public class ArenaListener
return;
}
// If they already had a class, make sure to change the "in use" in the Class Limit Manager
if (oldAC != null) {
classLimits.playerChangedClass(oldAC);
}
// Increment the "in use" in the Class Limit Manager
classLimits.playerPickedClass(newAC);