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