diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index bc3a7c890..0b399393d 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1858,20 +1858,22 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (binding == null) { return null; } - int pos = binding.messagesView.getLastVisiblePosition(); - if (pos >= 0) { - Message message = null; - for (int i = pos; i >= 0; --i) { - message = (Message) binding.messagesView.getItemAtPosition(i); - if (message.getType() != Message.TYPE_STATUS) { - break; + synchronized (this.messageList) { + int pos = binding.messagesView.getLastVisiblePosition(); + if (pos >= 0) { + Message message = null; + for (int i = pos; i >= 0; --i) { + message = (Message) binding.messagesView.getItemAtPosition(i); + if (message.getType() != Message.TYPE_STATUS) { + break; + } } - } - if (message != null) { - while (message.next() != null && message.next().wasMergedIntoPrevious()) { - message = message.next(); + if (message != null) { + while (message.next() != null && message.next().wasMergedIntoPrevious()) { + message = message.next(); + } + return message.getUuid(); } - return message.getUuid(); } } return null; |