From 7f3ebbb85d923051f047e1638f4c615d89c3a186 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Tue, 1 Oct 2024 20:58:55 +0000 Subject: [PATCH] Prevent crash with duplicate room suggestion If two rooms have the same canonical alias, e.g. the recently tombstoned and upgraded #foundation-office:matrix.org, typing `#foun` into the composer could cause the app to crash. This avoids that by using the (hopefully) globally unique room id as the key instead. Signed-off-by: Joe Groocock --- .../impl/messagecomposer/suggestions/SuggestionsPickerView.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/suggestions/SuggestionsPickerView.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/suggestions/SuggestionsPickerView.kt index 7209daccfd..7a9c542a1b 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/suggestions/SuggestionsPickerView.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/suggestions/SuggestionsPickerView.kt @@ -60,7 +60,7 @@ fun SuggestionsPickerView( when (suggestion) { is ResolvedSuggestion.AtRoom -> "@room" is ResolvedSuggestion.Member -> suggestion.roomMember.userId.value - is ResolvedSuggestion.Alias -> suggestion.roomAlias.value + is ResolvedSuggestion.Alias -> suggestion.roomSummary.roomId.value } } ) {