diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt index 1ede0b5048..73aeb14eaf 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt @@ -1425,9 +1425,9 @@ fun BoxWithConstraintsScope.FloatingButtons( val lastVisibleItem by remember { derivedStateOf { - if (lastIndexOfVisibleItems >= 0) { + if (lastIndexOfVisibleItems >= 0 && firstVisibleIndex >= 0) { val lastVisibleChatItemIndex = chatItems.value.lastIndex - firstVisibleIndex - lastIndexOfVisibleItems - chatItems.value[lastVisibleChatItemIndex] + chatItems.value.getOrNull(lastVisibleChatItemIndex) } else { null }