Merge pull request #3803 from nextcloud/bugfix/noid/fixNpeForConversationCreation

avoid NPE when context is not known when creating conversation
This commit is contained in:
Sowjanya Kota 2024-04-05 10:15:26 +02:00 committed by GitHub
commit e57f08f2d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -208,6 +208,7 @@ class CreateConversationDialogFragment : DialogFragment() {
Log.e(TAG, "Failed to create conversation")
showError()
}
else -> {}
}
}
@ -256,13 +257,14 @@ class CreateConversationDialogFragment : DialogFragment() {
}
private fun initiateConversation(roomToken: String) {
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken)
val chatIntent = Intent(context, ChatActivity::class.java)
chatIntent.putExtras(bundle)
chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(chatIntent)
activity?.let {
val bundle = Bundle()
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomToken)
val chatIntent = Intent(it, ChatActivity::class.java)
chatIntent.putExtras(bundle)
chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(chatIntent)
}
dismiss()
}