From f51568b331a105b60f2499ccadf823d71e9044a4 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 8 Jul 2020 22:09:39 +0200 Subject: [PATCH] Fix a crash (#548) --- .../features/userdirectory/PhoneBookController.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/features/userdirectory/PhoneBookController.kt b/vector/src/main/java/im/vector/riotx/features/userdirectory/PhoneBookController.kt index 6a79a4b15d..e4266183df 100644 --- a/vector/src/main/java/im/vector/riotx/features/userdirectory/PhoneBookController.kt +++ b/vector/src/main/java/im/vector/riotx/features/userdirectory/PhoneBookController.kt @@ -92,10 +92,11 @@ class PhoneBookController @Inject constructor( avatarRenderer(avatarRenderer) } mappedContact.emails - .filter { !onlyBoundContacts || it.matrixId != null } - .forEach { + .forEachIndexed { index, it -> + if (onlyBoundContacts && it.matrixId == null) return@forEachIndexed + contactDetailItem { - id("$mappedContact.id${it.email}") + id("${mappedContact.id}-$index-${it.email}") threePid(it.email) matrixId(it.matrixId) clickListener { @@ -108,10 +109,11 @@ class PhoneBookController @Inject constructor( } } mappedContact.msisdns - .filter { !onlyBoundContacts || it.matrixId != null } - .forEach { + .forEachIndexed { index, it -> + if (onlyBoundContacts && it.matrixId == null) return@forEachIndexed + contactDetailItem { - id("$mappedContact.id${it.phoneNumber}") + id("${mappedContact.id}-$index-${it.phoneNumber}") threePid(it.phoneNumber) matrixId(it.matrixId) clickListener {