Fixed crashes related to lateinit property used before being initialized found on Crashlytics

This commit is contained in:
Sylvain Berfini 2025-07-17 09:40:47 +02:00
parent c32bac7b07
commit 70df098ee4
2 changed files with 12 additions and 7 deletions

View file

@ -180,12 +180,14 @@ class ContactViewModel
private val contactsListener = object : ContactsManager.ContactsListener {
@WorkerThread
override fun onContactsLoaded() {
val friend = coreContext.contactsManager.findContactById(refKey)
if (friend != null && friend != this@ContactViewModel.friend) {
if (!::friend.isInitialized) return
val found = coreContext.contactsManager.findContactById(refKey)
if (found != null && found != friend) {
Log.i(
"$TAG Found contact [${friend.name}] matching ref key [$refKey] after contacts have been loaded/updated"
"$TAG Found contact [${found.name}] matching ref key [$refKey] after contacts have been loaded/updated"
)
this@ContactViewModel.friend = friend
friend = found
refreshContactInfo()
}
}

View file

@ -192,6 +192,7 @@ class HistoryViewModel
@UiThread
fun startAudioCall() {
coreContext.postOnCoreThread { core ->
if (!::address.isInitialized) return@postOnCoreThread
coreContext.startAudioCall(address)
}
}
@ -199,6 +200,7 @@ class HistoryViewModel
@UiThread
fun startVideoCall() {
coreContext.postOnCoreThread { core ->
if (!::address.isInitialized) return@postOnCoreThread
coreContext.startVideoCall(address)
}
}
@ -218,6 +220,8 @@ class HistoryViewModel
@UiThread
fun goToConversation() {
coreContext.postOnCoreThread { core ->
if (!::address.isInitialized) return@postOnCoreThread
val account = core.defaultAccount
val localSipUri = account?.params?.identityAddress?.asStringUriOnly()
if (!localSipUri.isNullOrEmpty()) {
@ -315,11 +319,10 @@ class HistoryViewModel
@UiThread
fun goToMeetingWaitingRoom() {
coreContext.postOnCoreThread {
if (::address.isInitialized) {
if (!::address.isInitialized) return@postOnCoreThread
conferenceToJoinEvent.postValue(Event(address.asStringUriOnly()))
}
}
}
@WorkerThread
private fun computeCallLogs() {