1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 07:42:06 +01:00

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

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;
}