Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix? NPE for currentUser in ConversationList #4443

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ class ConversationsListActivity :
conversationsListViewModel = ViewModelProvider(this, viewModelFactory)[ConversationsListViewModel::class.java]

binding = ActivityConversationsBinding.inflate(layoutInflater)

currentUser = userManager.currentUser.blockingGet()
setupActionBar()
setContentView(binding.root)
setupSystemColors()
Expand Down Expand Up @@ -278,7 +280,7 @@ class ConversationsListActivity :
if (!eventBus.isRegistered(this)) {
eventBus.register(this)
}
currentUser = userManager.currentUser.blockingGet()

if (currentUser != null) {
if (isServerEOL(currentUser!!.serverVersion?.major)) {
showServerEOLDialog()
Expand All @@ -296,7 +298,7 @@ class ConversationsListActivity :
fetchRooms()
fetchPendingInvitations()
} else {
Log.e(TAG, "userManager.currentUser.blockingGet() returned null")
Log.e(TAG, "currentUser is null")
Snackbar.make(binding.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show()
}

Expand Down Expand Up @@ -762,9 +764,8 @@ class ConversationsListActivity :
)
}

private fun hasActivityActionSendIntent(): Boolean {
return Intent.ACTION_SEND == intent.action || Intent.ACTION_SEND_MULTIPLE == intent.action
}
private fun hasActivityActionSendIntent(): Boolean =
Intent.ACTION_SEND == intent.action || Intent.ACTION_SEND_MULTIPLE == intent.action

private fun showSearchView(searchView: SearchView?, searchItem: MenuItem?) {
binding.conversationListAppbar.stateListAnimator = AnimatorInflater.loadStateListAnimator(
Expand Down Expand Up @@ -1269,10 +1270,9 @@ class ConversationsListActivity :
!participantPermissions.canIgnoreLobby()
}

private fun isReadOnlyConversation(conversation: ConversationModel): Boolean {
return conversation.conversationReadOnlyState ===
private fun isReadOnlyConversation(conversation: ConversationModel): Boolean =
conversation.conversationReadOnlyState ===
ConversationEnums.ConversationReadOnlyState.CONVERSATION_READ_ONLY
}

private fun handleSharedData() {
collectDataFromIntent()
Expand Down
Loading