Fixed crash reported on PlayStore

This commit is contained in:
Sylvain Berfini 2021-07-12 17:48:17 +02:00
parent 379f19067a
commit 9d4ebdb960
2 changed files with 10 additions and 4 deletions

View file

@ -442,7 +442,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
}
fun transferCallTo(addressToCall: String) {
val currentCall = core.currentCall ?: core.calls.first()
val currentCall = core.currentCall ?: core.calls.firstOrNull()
if (currentCall == null) {
Log.e("[Context] Couldn't find a call to transfer")
} else {

View file

@ -61,14 +61,20 @@ class AppUtils {
fun getInitials(displayName: String, limit: Int = 2): String {
if (displayName.isEmpty()) return ""
val emoji = EmojiCompat.get()
val split = displayName.toUpperCase(Locale.getDefault()).split(" ")
val split = displayName.uppercase(Locale.getDefault()).split(" ")
var initials = ""
var characters = 0
val emoji = try {
EmojiCompat.get()
} catch (ise: IllegalStateException) {
Log.e("[App Utils] Can't get EmojiCompat: $ise")
null
}
for (i in split.indices) {
if (split[i].isNotEmpty()) {
if (emoji.hasEmojiGlyph(split[i])) {
if (emoji?.hasEmojiGlyph(split[i]) == true) {
initials += emoji.process(split[i])
} else {
initials += split[i][0]