mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Prevent crash in message notification if person name is empty
This commit is contained in:
parent
243a6d8cb2
commit
95ce77e0e4
2 changed files with 4 additions and 4 deletions
|
|
@ -628,7 +628,7 @@ class ContactsManager
|
|||
val name = account?.params?.identityAddress?.displayName ?: LinphoneUtils.getDisplayName(
|
||||
localAddress
|
||||
)
|
||||
val personBuilder = Person.Builder().setName(name)
|
||||
val personBuilder = Person.Builder().setName(name.ifEmpty { "Unknown" })
|
||||
|
||||
val photo = account?.params?.pictureUri.orEmpty()
|
||||
val bm = ImageUtils.getBitmap(coreContext.context, photo)
|
||||
|
|
@ -747,7 +747,7 @@ fun Friend.getPerson(): Person {
|
|||
"Unknown"
|
||||
}
|
||||
}
|
||||
personBuilder.setName(personName)
|
||||
personBuilder.setName(personName.orEmpty().ifEmpty { "Unknown" })
|
||||
|
||||
val bm: Bitmap? = getAvatarBitmap()
|
||||
personBuilder.setIcon(
|
||||
|
|
|
|||
|
|
@ -1310,7 +1310,7 @@ class NotificationsManager
|
|||
remoteAddress
|
||||
)
|
||||
Person.Builder()
|
||||
.setName(subject)
|
||||
.setName(subject.ifEmpty { "Unknown" })
|
||||
.setIcon(
|
||||
AvatarGenerator(context).setInitials(AppUtils.getInitials(subject)).buildIcon()
|
||||
)
|
||||
|
|
@ -1724,7 +1724,7 @@ class NotificationsManager
|
|||
private fun getPerson(friend: Friend?, fallbackDisplayName: String): Person {
|
||||
return friend?.getPerson()
|
||||
?: Person.Builder()
|
||||
.setName(if (fallbackDisplayName.isEmpty()) "Unknown" else fallbackDisplayName)
|
||||
.setName(fallbackDisplayName.ifEmpty { "Unknown" })
|
||||
.setIcon(
|
||||
AvatarGenerator(context).setInitials(AppUtils.getInitials(fallbackDisplayName)).buildIcon()
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue