diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 0c53e7ccf..fea58462d 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2341,21 +2341,24 @@ public class XmppConnectionService extends Service { String replyId = reply.getAttribute("id"); + if (replyId == null) { + continue; + } Message replyMessage = null; for (Message rep : messages) { - if (replyId.equals(rep.getServerMsgId())) { + if (StringUtils.equals(replyId,rep.getServerMsgId())) { replyMessage = rep; break; } - if (replyId.equals(rep.getRemoteMsgId())) { + if (StringUtils.equals(replyId, rep.getRemoteMsgId())) { replyMessage = rep; break; } - if (replyId.equals(rep.getUuid())) { + if (StringUtils.equals(replyId, rep.getUuid())) { replyMessage = rep; break; } @@ -2381,23 +2384,26 @@ public class XmppConnectionService extends Service { List restored = databaseBackend.getMessagesByIds(conversation, notFoundReplies.keySet()); for (String id : notFoundReplies.keySet()) { + ArrayList notFoundRepliesMessages = notFoundReplies.get(id); + if (notFoundRepliesMessages == null) continue; + for (Message m : restored) { - if (id.equals(m.getServerMsgId())) { - for (Message rm : notFoundReplies.get(id)) { + if (StringUtils.equals(id, m.getServerMsgId())) { + for (Message rm : notFoundRepliesMessages) { rm.setReplyMessage(m, true); } break; } - if (id.equals(m.getRemoteMsgId())) { - for (Message rm : notFoundReplies.get(id)) { + if (StringUtils.equals(id, m.getRemoteMsgId())) { + for (Message rm : notFoundRepliesMessages) { rm.setReplyMessage(m, true); } break; } - if (id.equals(m.getUuid())) { - for (Message rm : notFoundReplies.get(id)) { + if (StringUtils.equals(id, m.getUuid())) { + for (Message rm : notFoundRepliesMessages) { rm.setReplyMessage(m, true); } break;