mirror of
https://github.com/LiveFastEatTrashRaccoon/RaccoonForLemmy.git
synced 2025-02-03 13:57:32 +01:00
fix: comment navigation if empty (#865)
This commit is contained in:
parent
e434f49d6a
commit
8c9ff8e4d9
@ -873,7 +873,7 @@ class PostDetailViewModel(
|
||||
}
|
||||
|
||||
private fun navigateToPreviousComment(index: Int) {
|
||||
val comments = uiState.value.comments
|
||||
val comments = uiState.value.comments.takeIf { it.isNotEmpty() } ?: return
|
||||
val (start, end) = 0 to index.coerceAtMost(comments.lastIndex)
|
||||
val newIndex =
|
||||
comments.subList(
|
||||
@ -890,7 +890,7 @@ class PostDetailViewModel(
|
||||
}
|
||||
|
||||
private fun navigateToNextComment(index: Int) {
|
||||
val comments = uiState.value.comments
|
||||
val comments = uiState.value.comments.takeIf { it.isNotEmpty() } ?: return
|
||||
val (start, end) = (index + 1).coerceAtMost(comments.lastIndex) to comments.lastIndex
|
||||
val newIndex =
|
||||
comments.subList(
|
||||
|
Loading…
x
Reference in New Issue
Block a user