From 475c5569186c29fa7206d7f6377e19caada20ac4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 18 Nov 2024 15:34:16 -0500 Subject: [PATCH] Try to fix occasional sorting crashes (cherry picked from commit 4e805c8ccc9c721c15571a1f098968dde96cf220) --- src/main/java/eu/siacs/conversations/entities/Bookmark.java | 4 ++++ .../eu/siacs/conversations/ui/StartConversationActivity.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index 68dd349cf..8e0c175dd 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -164,6 +164,10 @@ public class Bookmark extends Element implements ListItem { return 1; } + if (getDisplayName().equals(another.getDisplayName())) { + return getJid().compareTo(another.getJid()); + } + return this.getDisplayName().compareToIgnoreCase( another.getDisplayName()); } diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 62229a633..e50a9d8f6 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -1403,7 +1403,7 @@ public class StartConversationActivity extends XmppActivity protected void filter(String needle) { if (xmppConnectionServiceBound) { - this.filterContacts(needle); + synchronized(this.contacts) { this.filterContacts(needle); } this.filterConferences(needle); } }