Skip to content

Commit 83979f9

Browse files
authored
fix(android) : index out of bounds crash (#805)
1 parent d0b77b3 commit 83979f9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

android/src/main/java/com/reactnativepagerview/ViewPagerAdapter.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ class ViewPagerAdapter() : Adapter<ViewPagerViewHolder>() {
6363
}
6464

6565
fun removeChildAt(index: Int) {
66-
childrenViews.removeAt(index)
67-
notifyItemRemoved(index)
66+
if (index >= 0 && index < childrenViews.size) {
67+
childrenViews.removeAt(index)
68+
notifyItemRemoved(index)
69+
}
6870
}
6971
}

0 commit comments

Comments
 (0)