Commit a6437046 authored by Josh Gitlin's avatar Josh Gitlin Committed by Guus der Kinderen

Fixing NullPointerException caused by having a mix of valid Groups and NULLs...

Fixing NullPointerException caused by having a mix of valid Groups and NULLs inside the result of getGroupsFromKeys
parent cc20210e
...@@ -46,7 +46,9 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement ...@@ -46,7 +46,9 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
JID target = (JID) key; JID target = (JID) key;
Iterator<Group> iterator = getGroupsFromKeys().iterator(); Iterator<Group> iterator = getGroupsFromKeys().iterator();
while (!found && iterator.hasNext()) { while (!found && iterator.hasNext()) {
found = iterator.next().isUser(target); Group next = iterator.next();
if(next != null)
found = next.isUser(target);
} }
} }
return found; return found;
...@@ -86,7 +88,9 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement ...@@ -86,7 +88,9 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
public synchronized Set<Group> getGroupsFromKeys() { public synchronized Set<Group> getGroupsFromKeys() {
Set<Group> result = new HashSet<>(); Set<Group> result = new HashSet<>();
for(String groupName : getKnownGroupNamesFromKeys()) { for(String groupName : getKnownGroupNamesFromKeys()) {
result.add(Group.resolveFrom(groupName)); Group resolved = Group.resolveFrom(groupName);
if(resolved != null)
result.add(resolved);
} }
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment