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

Commit 01658fc7 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[AsyncHybridViewInflation] Fix crash in Historic Message handling

groupMessages throws ArrayIndexOutOfBoundsException when there is historic message.
This CL make this change inline with the logic in ConversationLayout.

Bug: 217799515
Test: check Add Historic for MessagingStyle Notification and add notification. Observe no crash
Flag: ACONFIG notification_async_hybrid_view_inflation DEVELOPMENT
Change-Id: Ic2c1d8d5bf1df209a876168469e0e82fe0225f1e
parent 81b273a7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -217,8 +217,9 @@ internal object SingleLineViewInflater {
        var currentGroup: MutableList<MessagingStyle.Message>? = null
        var currentSenderKey: CharSequence? = null
        val groups = mutableListOf<MutableList<MessagingStyle.Message>>()
        for (i in 0 until (historicMessages.size + messages.size)) {
            val message = if (i < historicMessages.size) historicMessages[i] else messages[i]
        val histSize = historicMessages.size
        for (i in 0 until (histSize + messages.size)) {
            val message = if (i < histSize) historicMessages[i] else messages[i - histSize]

            val sender = message.senderPerson
            val senderKey = sender?.getKeyOrName()