aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-04-23 21:36:56 +0200
committerChristian Schneppe <christian@pix-art.de>2018-04-23 21:36:56 +0200
commita66f8bffab6336082ba0e7393110256e08f656b1 (patch)
tree5040e8972c6df1f05637d3f21bfbafb89c7486c1 /src/main/java/de/pixart/messenger
parentfd097d068c3858bf2cc7ebfb3a86cafad0ebe4bb (diff)
synchronize around getting last visibile uuid
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java26
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;