fixed npe in message parser

This commit is contained in:
iNPUTmice 2015-03-06 21:14:55 +01:00
parent 16c6f8d2ff
commit 44028a547f

View File

@ -143,7 +143,7 @@ public class MessageParser extends AbstractParser implements
finishedMessage.setRemoteMsgId(packet.getId()); finishedMessage.setRemoteMsgId(packet.getId());
finishedMessage.markable = isMarkable(packet); finishedMessage.markable = isMarkable(packet);
finishedMessage.setCounterpart(from); finishedMessage.setCounterpart(from);
extractChatState(conversation,packet); extractChatState(conversation, packet);
return finishedMessage; return finishedMessage;
} catch (Exception e) { } catch (Exception e) {
conversation.resetOtrSession(); conversation.resetOtrSession();
@ -408,11 +408,11 @@ public class MessageParser extends AbstractParser implements
.getAttribute("id"); .getAttribute("id");
updateLastseen(packet, account, true); updateLastseen(packet, account, true);
final Message displayedMessage = mXmppConnectionService.markMessage(account, from.toBareJid(), id, Message.STATUS_SEND_DISPLAYED); final Message displayedMessage = mXmppConnectionService.markMessage(account, from.toBareJid(), id, Message.STATUS_SEND_DISPLAYED);
Message message = displayedMessage.prev(); Message message = displayedMessage == null ? null :displayedMessage.prev();
while(message != null while (message != null
&& message.getStatus() == Message.STATUS_SEND_RECEIVED && message.getStatus() == Message.STATUS_SEND_RECEIVED
&& message.getTimeSent() < displayedMessage.getTimeSent()) { && message.getTimeSent() < displayedMessage.getTimeSent()) {
mXmppConnectionService.markMessage(message,Message.STATUS_SEND_DISPLAYED); mXmppConnectionService.markMessage(message, Message.STATUS_SEND_DISPLAYED);
message = message.prev(); message = message.prev();
} }
} else if (from != null } else if (from != null