When calling .setData(list) with empty list - for example when users update pictures in the gallery - library crashes with the following error.
Originally when Carousel started empty - it shows empty picture as expected, when later setiing some pictures and set it again with empty list following error is thrown.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: fit.jeem.stage, PID: 15814
java.lang.ArithmeticException: divide by zero
at org.imaginativeworld.whynotimagecarousel.adapter.InfiniteCarouselAdapter.getRealDataPosition(InfiniteCarouselAdapter.kt:38)
at org.imaginativeworld.whynotimagecarousel.ImageCarousel$initListeners$1.onScrolled(ImageCarousel.kt:819)
at androidx.recyclerview.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:5347)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:4405)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4031)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1873)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1873)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at androidx.constraintlayout.widget.ConstraintLayout.onLayout(ConstraintLayout.java:1873)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
at android.view.View.layout(View.java:21912)
at android.view.ViewGroup.layout(ViewGroup.java:6260)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
When calling .setData(list) with empty list - for example when users update pictures in the gallery - library crashes with the following error.
Originally when Carousel started empty - it shows empty picture as expected, when later setiing some pictures and set it again with empty list following error is thrown.