fixed potential npes in message parser

This commit is contained in:
iNPUTmice 2014-12-02 23:59:40 +01:00
parent 241de062da
commit 9152e1ac95
1 changed files with 7 additions and 2 deletions

View File

@ -27,8 +27,10 @@ public class MessageParser extends AbstractParser implements
private Message parseChat(MessagePacket packet, Account account) { private Message parseChat(MessagePacket packet, Account account) {
final Jid jid = packet.getFrom(); final Jid jid = packet.getFrom();
Conversation conversation = mXmppConnectionService if (jid == null) {
.findOrCreateConversation(account, jid.toBareJid(), false); return null;
}
Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid.toBareJid(), false);
updateLastseen(packet, account, true); updateLastseen(packet, account, true);
String pgpBody = getPgpBody(packet); String pgpBody = getPgpBody(packet);
Message finishedMessage; Message finishedMessage;
@ -61,6 +63,9 @@ public class MessageParser extends AbstractParser implements
boolean properlyAddressed = (!packet.getTo().isBareJid()) boolean properlyAddressed = (!packet.getTo().isBareJid())
|| (account.countPresences() == 1); || (account.countPresences() == 1);
final Jid from = packet.getFrom(); final Jid from = packet.getFrom();
if (from == null) {
return null;
}
Conversation conversation = mXmppConnectionService Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account, from.toBareJid(), false); .findOrCreateConversation(account, from.toBareJid(), false);
String presence; String presence;