fix a crash at clicking on a contact without phone numbers

This commit is contained in:
tibbi
2023-03-14 10:30:08 +01:00
parent a7fa1f9fe4
commit 223e09a85c

View File

@@ -144,7 +144,9 @@ class FavoritesFragment(context: Context, attributeSet: AttributeSet) : MyViewPa
private fun callContact(simpleContact: Contact) { private fun callContact(simpleContact: Contact) {
val phoneNumbers = simpleContact.phoneNumbers val phoneNumbers = simpleContact.phoneNumbers
if (phoneNumbers.size <= 1) { if (phoneNumbers.isEmpty()) {
return
} else if (phoneNumbers.size <= 1) {
activity?.launchCallIntent(phoneNumbers.first().normalizedNumber) activity?.launchCallIntent(phoneNumbers.first().normalizedNumber)
} else { } else {
val primaryNumber = simpleContact.phoneNumbers.find { it.isPrimary } val primaryNumber = simpleContact.phoneNumbers.find { it.isPrimary }