prevent crash when counterpart in message was null

This commit is contained in:
Daniel Gultsch 2019-11-10 11:30:31 +01:00
parent 7b7719db8c
commit 97745bdfbe
1 changed files with 6 additions and 2 deletions

View File

@ -307,9 +307,13 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
synchronized (this.messages) {
for (int i = this.messages.size() - 1; i >= 0; --i) {
final Message message = messages.get(i);
final Jid mcp = message.getCounterpart();
if (mcp == null) {
continue;
}
final boolean counterpartMatch = mode == MODE_SINGLE ?
counterpart.asBareJid().equals(message.getCounterpart().asBareJid()) :
counterpart.equals(message.getCounterpart());
counterpart.asBareJid().equals(mcp.asBareJid()) :
counterpart.equals(mcp);
if (counterpartMatch && ((message.getStatus() == Message.STATUS_RECEIVED) == received)
&& (carbon == message.isCarbon() || received)) {
final boolean idMatch = id.equals(message.getRemoteMsgId()) || message.remoteMsgIdMatchInEdit(id);