Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e3ca866b authored by Moez Bhatti's avatar Moez Bhatti Committed by Dayona Joseph
Browse files

Fix crash when deleting conversation

parent 84d9c7dd
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -80,14 +80,18 @@ class ConversationInfoPresenter @Inject constructor(
        disposables += markUnarchived
        disposables += deleteConversations

        val partsObservable = messageRepo.getPartsForConversation(threadId)
                .asObservable()
                .filter { parts -> parts.isLoaded && parts.isValid}

        disposables += Observables
                .combineLatest(conversation, partsObservable) { conversation, parts ->
                .combineLatest(
                        conversation,
                        messageRepo.getPartsForConversation(threadId).asObservable()
                ) { conversation, parts ->
                    val data = mutableListOf<ConversationInfoItem>()

                    // If some data was deleted, this isn't the place to handle it
                    if (!conversation.isLoaded || !conversation.isValid || !parts.isLoaded || !parts.isValid) {
                        return@combineLatest
                    }

                    data += conversation.recipients.map(::ConversationInfoRecipient)
                    data += ConversationInfoItem.ConversationInfoSettings(
                            name = conversation.name,