summaryrefslogtreecommitdiffhomepage
path: root/android
diff options
context:
space:
mode:
authorKalle Lindström <karl.lindstrom@mullvad.net>2025-08-01 17:49:39 +0200
committerKalle Lindström <karl.lindstrom@mullvad.net>2025-08-04 09:13:49 +0200
commita94e359bd8809b26e9b48560283d32c3f4f8e68a (patch)
tree3007a0528366c843621a2d60c8c6f9196b777f0e /android
parent3e0e65110b66d6f3ea7192a0d45ec8380df8ff0e (diff)
downloadmullvadvpn-a94e359bd8809b26e9b48560283d32c3f4f8e68a.tar.xz
mullvadvpn-a94e359bd8809b26e9b48560283d32c3f4f8e68a.zip
Fix crash with DAITA and multihop recents
Diffstat (limited to 'android')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt6
1 files changed, 5 insertions, 1 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt
index f1ccd360b3..64ccd99452 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/location/RelayItemListCreator.kt
@@ -131,7 +131,6 @@ private fun createRecentsSection(
is Hop.Single<*> -> selectionIsSingle
}
}
- .take(RECENTS_MAX_VISIBLE)
.map { recent ->
val isSelected = recent.matches(itemSelection, isEntryBlocked)
if (isEntryBlocked) {
@@ -145,6 +144,11 @@ private fun createRecentsSection(
RelayListItem.RecentListItem(hop = recent, isSelected = isSelected)
}
}
+ // Convert to a set to remove possible duplicates. We can get duplicate entries if
+ // multihop is enabled and isEntryBlocked is true, because multiple multihop recents
+ // can have the same exit.
+ .toSet()
+ .take(RECENTS_MAX_VISIBLE)
addAll(shown)
if (shown.isEmpty()) {