1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-23 04:22:05 +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); Chat match = jidChats.get(userJID);
if (match == null && (matchMode == MatchMode.BARE_JID)) { 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; return match;
} }