sparrow007 / CarouselRecyclerview

Carousel Recyclerview let's you create carousel layout with the power of recyclerview by creating custom layout manager.
Apache License 2.0
640 stars 79 forks source link

java.lang.ArithmeticException: divide by zero #16

Closed Andrew0000 closed 2 years ago

Andrew0000 commented 2 years ago

It's stable crash on scrolling, probably when re-assign items and adapter on scrolling animation.

java.lang.ArithmeticException: divide by zero at com.jackandphantom.carouselrecyclerview.CarouselLayoutManager.onSelectedCallback(CarouselLayoutManager.kt:543) at com.jackandphantom.carouselrecyclerview.CarouselLayoutManager.access$onSelectedCallback(CarouselLayoutManager.kt:17) at com.jackandphantom.carouselrecyclerview.CarouselLayoutManager$startScroll$2.onAnimationEnd(CarouselLayoutManager.kt:383) at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1149) at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1309) at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146) at android.animation.AnimationHandler.-wrap2(AnimationHandler.java) at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:869) at android.view.Choreographer.doCallbacks(Choreographer.java:683) at android.view.Choreographer.doFrame(Choreographer.java:616) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

Andrew0000 commented 2 years ago

Easy reproduction: just swipe on recycler with 0 items

sparrow007 commented 2 years ago

@Andrew0000 Thanks for this issue and the steps for reproducing it.