Fix NPE in ChatManager: Check if null

bareJidChats is a ConcurrentHashMap which does not allow 'null' keys,
thus get(null) returns a NPE. And asEntityBareJidIfPossible may return
'null', this could happen.
This commit is contained in:
Florian Schmaus 2015-11-20 21:08:12 +01:00
parent b849d4102b
commit 19469b0faf
1 changed files with 4 additions and 1 deletions

View File

@ -322,7 +322,10 @@ public final class ChatManager extends Manager{
Chat match = jidChats.get(userJID);
if (match == null && (matchMode == MatchMode.BARE_JID)) {
match = baseJidChats.get(userJID.asEntityBareJidIfPossible());
EntityBareJid entityBareJid = userJID.asEntityBareJidIfPossible();
if (entityBareJid != null) {
match = baseJidChats.get(entityBareJid);
}
}
return match;
}