Check for null

This commit is contained in:
Trent Hensler 2018-02-03 12:38:36 -08:00
parent 249770d2cd
commit 9384b0faa6

View File

@ -326,6 +326,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
public Access getAccess(Permissable permissable, Action action) { public Access getAccess(Permissable permissable, Action action) {
if (permissable == null || action == null) {
return null;
}
Map<Action, Access> accessMap = permissions.get(permissable); Map<Action, Access> accessMap = permissions.get(permissable);
if (accessMap != null && accessMap.containsKey(action)) { if (accessMap != null && accessMap.containsKey(action)) {
return accessMap.get(action); return accessMap.get(action);
@ -342,6 +346,10 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
* @return * @return
*/ */
public Access getAccess(FPlayer player, Action action) { public Access getAccess(FPlayer player, Action action) {
if (player == null || action == null) {
return null;
}
Permissable perm; Permissable perm;
if (player.getFaction() == this) { if (player.getFaction() == this) {
@ -367,7 +375,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
accessMap.put(action, access); accessMap.put(action, access);
} }
public void resetPerms() { public void resetPerms() {
P.p.log(Level.WARNING, "Resetting permissions for Faction: " + tag); P.p.log(Level.WARNING, "Resetting permissions for Faction: " + tag);