Prevent crash due to calling chatRoom.getLocalAddress() when it's in Instanciated state (because returned value is null)

This commit is contained in:
Sylvain Berfini 2024-09-02 16:26:39 +02:00
parent c2e1333be1
commit 95c4106bd0
6 changed files with 10 additions and 2 deletions

View file

@ -368,6 +368,8 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
@WorkerThread
override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) {
val state = chatRoom.state
if (state == ChatRoom.State.Instantiated) return
val id = LinphoneUtils.getChatRoomId(chatRoom)
Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]")

View file

@ -79,6 +79,8 @@ class ConversationForwardMessageViewModel @UiThread constructor() : AddressSelec
@WorkerThread
override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) {
val state = chatRoom.state
if (state == ChatRoom.State.Instantiated) return
val id = LinphoneUtils.getChatRoomId(chatRoom)
Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]")

View file

@ -61,6 +61,8 @@ class StartConversationViewModel @UiThread constructor() : AddressSelectionViewM
@WorkerThread
override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) {
val state = chatRoom.state
if (state == ChatRoom.State.Instantiated) return
val id = LinphoneUtils.getChatRoomId(chatRoom)
Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]")

View file

@ -192,6 +192,8 @@ class ContactViewModel @UiThread constructor() : GenericViewModel() {
@WorkerThread
override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) {
val state = chatRoom.state
if (state == ChatRoom.State.Instantiated) return
val id = LinphoneUtils.getChatRoomId(chatRoom)
Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]")

View file

@ -80,6 +80,8 @@ class HistoryViewModel @UiThread constructor() : GenericViewModel() {
@WorkerThread
override fun onStateChanged(chatRoom: ChatRoom, newState: ChatRoom.State?) {
val state = chatRoom.state
if (state == ChatRoom.State.Instantiated) return
val id = LinphoneUtils.getChatRoomId(chatRoom)
Log.i("$TAG Conversation [$id] (${chatRoom.subject}) state changed: [$state]")

View file

@ -77,8 +77,6 @@ class AccountSettingsViewModel @UiThread constructor() : GenericViewModel() {
val accountFoundEvent = MutableLiveData<Event<Boolean>>()
val showUpdatePasswordDialog = MutableLiveData<Event<String>>()
private lateinit var account: Account
private lateinit var natPolicy: NatPolicy