diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/entities')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Conversation.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index 9646a3990..5744d67a7 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -470,13 +470,11 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl } public Message getLatestMarkableMessage() { - for (int i = this.messages.size() - 1; i >= 0; --i) { - if (this.messages.get(i).getStatus() <= Message.STATUS_RECEIVED - && this.messages.get(i).markable) { - if (this.messages.get(i).isRead()) { - return null; - } else { - return this.messages.get(i); + synchronized (this.messages) { + for (int i = this.messages.size() - 1; i >= 0; --i) { + final Message message = this.messages.get(i); + if (message.getStatus() <= Message.STATUS_RECEIVED && message.markable) { + return message.isRead() ? null : message; } } } |