Divide by 0 crash when setting page count to 0.
AnupKhanal opened this issue · 1 comments
AnupKhanal commented
This happens when I increase the page count then I gradually decrease it to 0. I don't get this exception when i set page count to 1 and then back to 0. But if I set page count to more than that then i set it again to 0, i get this exception.
java.lang.ArithmeticException: divide by zero
at com.synnapps.carouselview.CarouselView$SwipeTask$1.run(CarouselView.java:409)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7116)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
Turns out the library is doing this which is causing the exception.
int nextPage = (containerViewPager.getCurrentItem() + 1) % getPageCount();
Byenkya commented
Is there a way to fix this bug?