Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide by 0 crash when setting page count to 0. #111

Open
AnupKhanal opened this issue May 20, 2019 · 1 comment
Open

Divide by 0 crash when setting page count to 0. #111

AnupKhanal opened this issue May 20, 2019 · 1 comment

Comments

@AnupKhanal
Copy link

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
Copy link

Byenkya commented Apr 29, 2021

Is there a way to fix this bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants