You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal Exception: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.get(ArrayList.java:437) at com.tbuonomo.viewpagerdotsindicator.BaseDotsIndicator.refreshDotsSize(BaseDotsIndicator.java:166) at com.tbuonomo.viewpagerdotsindicator.BaseDotsIndicator.access$refreshDotsSize(BaseDotsIndicator.java:20) at com.tbuonomo.viewpagerdotsindicator.BaseDotsIndicator$refreshDots$1.run(BaseDotsIndicator.java:150) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:247) at android.app.ActivityThread.main(ActivityThread.java:8656) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
For example we have 3 items in ViewPager2 adapter. This crash occurred when the last item is selected/opened then get new data and refresh the item.
Fatal Exception: java.lang.IndexOutOfBoundsException
Index: 1, Size: 1
com.tbuonomo.viewpagerdotsindicator.BaseDotsIndicator.refreshDotsSize (BaseDotsIndicator.kt:166)
in refreshDotsSize seems forgot to check the possibility of index out of bound
private fun refreshDotsSize() {
for (i in 0 until pager!!.currentItem) {
dots[i].setWidth(dotsSize.toInt())
}
}
maybe you can edit and change it into
private fun refreshDotsSize() {
for (i in 0 until pager!!.currentItem) {
if (i < dots.size){
dots[i].setWidth(dotsSize.toInt())
}
}
}
The text was updated successfully, but these errors were encountered: