diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt index 8a0e1e18fd..8a36131cc9 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/helper/TimelineControllerInterceptorHelper.kt @@ -100,8 +100,7 @@ class TimelineControllerInterceptorHelper(private val positionOfReadMarker: KMut val shouldAddBackwardPrefetch = timeline?.hasMoreToLoad(Timeline.Direction.BACKWARDS) ?: false if (shouldAddBackwardPrefetch) { val indexOfPrefetchBackward = (previousModelsSize - 1) - .coerceAtMost(size - DEFAULT_PREFETCH_THRESHOLD) - .coerceAtLeast(0) + .coerceIn(minimumValue = 0, maximumValue = size - DEFAULT_PREFETCH_THRESHOLD) val loadingItem = LoadingItem_() .id("prefetch_backward_loading${System.currentTimeMillis()}") @@ -116,8 +115,7 @@ class TimelineControllerInterceptorHelper(private val positionOfReadMarker: KMut val shouldAddForwardPrefetch = timeline?.hasMoreToLoad(Timeline.Direction.FORWARDS) ?: false if (shouldAddForwardPrefetch) { val indexOfPrefetchForward = DEFAULT_PREFETCH_THRESHOLD - .coerceAtMost(size - 1) - .coerceAtLeast(0) + .coerceIn(minimumValue = 0, maximumValue = size - 1) val loadingItem = LoadingItem_() .id("prefetch_forward_loading${System.currentTimeMillis()}")