Commit 9b6b00ed authored by Tom Evans's avatar Tom Evans

OF-874: Fix NPE if from/to is missing

Returns an empty iterator if the inbound packet is incomplete.
parent c348e9b9
...@@ -1200,8 +1200,10 @@ public class SessionManager extends BasicModule implements ClusterEventListener, ...@@ -1200,8 +1200,10 @@ public class SessionManager extends BasicModule implements ClusterEventListener,
@Override @Override
public Iterator<DiscoItem> getItems(String name, String node, JID senderJID) { public Iterator<DiscoItem> getItems(String name, String node, JID senderJID) {
try { try {
// If the requesting entity is the user itself or the sender or the requesting entity can probe the presence of the user. // If the requesting entity is the user itself or the requesting entity can probe the presence of the user.
if (server.getUserManager().isRegisteredUser(senderJID) && name.equals(senderJID.getNode()) || server.getPresenceManager().canProbePresence(senderJID, name)) { if (name != null && senderJID != null &&
server.getUserManager().isRegisteredUser(senderJID) &&
(name.equals(senderJID.getNode()) || server.getPresenceManager().canProbePresence(senderJID, name))) {
Collection<DiscoItem> discoItems = new ArrayList<DiscoItem>(); Collection<DiscoItem> discoItems = new ArrayList<DiscoItem>();
for (ClientSession clientSession : getSessions(name)) { for (ClientSession clientSession : getSessions(name)) {
discoItems.add(new DiscoItem(clientSession.getAddress(), null, null, null)); discoItems.add(new DiscoItem(clientSession.getAddress(), null, null, null));
......
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