diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt index 5590363b36..5e9bcf5dca 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatSections.kt @@ -221,12 +221,15 @@ fun List.chatItemPosition(chatItemId: Long): Int? { fun List.revealedItemCount(): Int { var count = 0 for (section in this) { - for (item in section.items) { + var i = 0; + while (i < section.items.size) { + val item = section.items[i] if (item.revealed) { count += item.items.size } else { count++ } + i++ } }