Fix crash in empty pager with indicator

commit_hash:8e795aaf30a1ee7548176657e97d34bb39012df6
This commit is contained in:
grechka62
2025-09-05 18:07:47 +03:00
parent 5aad643c03
commit 34371946cd
@@ -36,7 +36,10 @@ internal class DivPagerAdapter(
private val offsetToRealItem get() = if (infiniteScrollEnabled) OFFSET_TO_REAL_ITEM else 0
fun realItemPosition(position: Int) = (getRealPosition(position) + visibleItems.size) % visibleItems.size
fun realItemPosition(position: Int): Int {
val size = visibleItems.size.takeIf { it > 0 } ?: return 0
return (getRealPosition(position) + size) % size
}
var orientation = ViewPager2.ORIENTATION_HORIZONTAL