Prevent crash if composing is sent when chat room not initialized yet

This commit is contained in:
Sylvain Berfini 2025-02-03 09:43:17 +01:00
parent 0625239477
commit e5795ea05f

View file

@ -191,6 +191,7 @@ class SendMessageInConversationViewModel
@UiThread @UiThread
fun configureChatRoom(room: ChatRoom) { fun configureChatRoom(room: ChatRoom) {
Log.i("$TAG Chat room configured")
chatRoom = room chatRoom = room
coreContext.postOnCoreThread { coreContext.postOnCoreThread {
chatRoom.addListener(chatRoomListener) chatRoom.addListener(chatRoomListener)
@ -324,9 +325,11 @@ class SendMessageInConversationViewModel
@UiThread @UiThread
fun notifyChatMessageIsBeingComposed() { fun notifyChatMessageIsBeingComposed() {
coreContext.postOnCoreThread { coreContext.postOnCoreThread {
if (::chatRoom.isInitialized) {
chatRoom.compose() chatRoom.compose()
} }
} }
}
@UiThread @UiThread
fun openParticipantsList() { fun openParticipantsList() {