Prevent crash if identity address couldn't be parsed

This commit is contained in:
Sylvain Berfini 2024-12-16 10:03:45 +01:00
parent 3cdcc4bb77
commit f068b5c9ce
2 changed files with 14 additions and 2 deletions

View file

@ -192,6 +192,18 @@ class ThirdPartySipAccountLoginViewModel
}
}
val identityAddress = Factory.instance().createAddress(identity)
if (identityAddress == null) {
Log.e("$TAG Can't parse [$identity] as Address!")
showRedToastEvent.postValue(
Event(
Pair(
R.string.assistant_login_cant_parse_address_toast,
R.drawable.warning_circle
)
)
)
return@postOnCoreThread
}
newlyCreatedAuthInfo = Factory.instance().createAuthInfo(
user,

View file

@ -69,8 +69,8 @@ class PhoneNumberUtils {
ContactsContract.CommonDataKinds.Phone.TYPE_WORK_MOBILE -> "work,cell"
ContactsContract.CommonDataKinds.Phone.TYPE_WORK_PAGER -> "work,pager"
ContactsContract.CommonDataKinds.BaseTypes.TYPE_CUSTOM -> {
Log.i(
"$TAG Found custom phone label type using default value [$default] or 'custom' if null"
Log.d(
"$TAG Found custom phone label type using default value [$default] or will use 'custom' if null"
)
default ?: "custom"
}