Prevent crash when conversation fragment resumes if viewmodel doesn't have a chatRoom stored

This commit is contained in:
Sylvain Berfini 2024-10-17 09:47:09 +02:00
parent 6edd20e214
commit d03f94d52a

View file

@ -910,6 +910,12 @@ open class ConversationFragment : SlidingPaneChildFragment() {
override fun onResume() {
super.onResume()
if (!viewModel.isChatRoomInitialized()) {
Log.w("$TAG Fragment resuming but no chatRoom in viewModel, going back")
goBack()
return
}
viewModel.updateCurrentlyDisplayedConversation()
// Wait for items to be displayed