From 23dcda55d3162b90bdea6fc9e5d173912eae13b8 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sat, 28 Mar 2026 18:30:21 -0400 Subject: [PATCH] Solves crashing when multiple relays with the same url are included in the resulting list. --- .../ui/screen/loggedIn/search/SearchBarViewModel.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt index 02045f705..3aaf8dcb5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt @@ -233,8 +233,10 @@ class SearchBarViewModel( val lower = term.lowercase() val relays = - listOfNotNull(relayUrl) + - LocalCache.relayHints.relayDB.filter { _, relay -> relay.url.contains(lower) } + ( + listOfNotNull(relayUrl) + + LocalCache.relayHints.relayDB.filter { _, relay -> relay.url.contains(lower) } + ).distinctBy { it.url } relays .map { relaySetupInfoBuilder(it) }