From 9152e1ac95bb51de2189791a552c703cbca59f24 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Tue, 2 Dec 2014 23:59:40 +0100 Subject: fixed potential npes in message parser --- src/main/java/eu/siacs/conversations/parser/MessageParser.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index e2028c7b..8e559bd5 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -27,8 +27,10 @@ public class MessageParser extends AbstractParser implements private Message parseChat(MessagePacket packet, Account account) { final Jid jid = packet.getFrom(); - Conversation conversation = mXmppConnectionService - .findOrCreateConversation(account, jid.toBareJid(), false); + if (jid == null) { + return null; + } + Conversation conversation = mXmppConnectionService.findOrCreateConversation(account, jid.toBareJid(), false); updateLastseen(packet, account, true); String pgpBody = getPgpBody(packet); Message finishedMessage; @@ -61,6 +63,9 @@ public class MessageParser extends AbstractParser implements boolean properlyAddressed = (!packet.getTo().isBareJid()) || (account.countPresences() == 1); final Jid from = packet.getFrom(); + if (from == null) { + return null; + } Conversation conversation = mXmppConnectionService .findOrCreateConversation(account, from.toBareJid(), false); String presence; -- cgit v1.2.3