mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 19:49:33 +01:00
Merge pull request #4261 from nextcloud/bugfix/4190/avoidNpeCurrentConversation
try to avoid NPE for currentConversation
This commit is contained in:
commit
c3270079b4
@ -571,6 +571,7 @@ class ChatActivity :
|
||||
chatViewModel.getCapabilitiesViewState.observe(this) { state ->
|
||||
when (state) {
|
||||
is ChatViewModel.GetCapabilitiesUpdateState -> {
|
||||
if (currentConversation != null) {
|
||||
spreedCapabilities = state.spreedCapabilities
|
||||
chatApiVersion = ApiUtils.getChatApiVersion(spreedCapabilities, intArrayOf(1))
|
||||
participantPermissions = ParticipantPermissions(spreedCapabilities, currentConversation!!)
|
||||
@ -579,9 +580,16 @@ class ChatActivity :
|
||||
checkShowCallButtons()
|
||||
checkLobbyState()
|
||||
updateRoomTimerHandler()
|
||||
} else {
|
||||
Log.w(
|
||||
TAG,
|
||||
"currentConversation was null in observer ChatViewModel.GetCapabilitiesUpdateState"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is ChatViewModel.GetCapabilitiesInitialLoadState -> {
|
||||
if (currentConversation != null) {
|
||||
spreedCapabilities = state.spreedCapabilities
|
||||
chatApiVersion = ApiUtils.getChatApiVersion(spreedCapabilities, intArrayOf(1))
|
||||
participantPermissions = ParticipantPermissions(spreedCapabilities, currentConversation!!)
|
||||
@ -607,7 +615,8 @@ class ChatActivity :
|
||||
checkLobbyState()
|
||||
updateRoomTimerHandler()
|
||||
|
||||
val urlForChatting = ApiUtils.getUrlForChat(chatApiVersion, conversationUser?.baseUrl, roomToken)
|
||||
val urlForChatting =
|
||||
ApiUtils.getUrlForChat(chatApiVersion, conversationUser?.baseUrl, roomToken)
|
||||
|
||||
if (adapter?.isEmpty == true) {
|
||||
chatViewModel.loadMessages(
|
||||
@ -615,6 +624,12 @@ class ChatActivity :
|
||||
withUrl = urlForChatting
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Log.w(
|
||||
TAG,
|
||||
"currentConversation was null in observer ChatViewModel.GetCapabilitiesInitialLoadState"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
is ChatViewModel.GetCapabilitiesErrorState -> {
|
||||
|
Loading…
Reference in New Issue
Block a user