mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
Fix crash in empty pager with indicator
commit_hash:8e795aaf30a1ee7548176657e97d34bb39012df6
This commit is contained in:
+4
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user