diff --git a/app/src/main/java/com/cappielloantonio/play/helper/recyclerview/DotsIndicatorDecoration.java b/app/src/main/java/com/cappielloantonio/play/helper/recyclerview/DotsIndicatorDecoration.java index 647a90ae..27198e99 100644 --- a/app/src/main/java/com/cappielloantonio/play/helper/recyclerview/DotsIndicatorDecoration.java +++ b/app/src/main/java/com/cappielloantonio/play/helper/recyclerview/DotsIndicatorDecoration.java @@ -51,6 +51,10 @@ public class DotsIndicatorDecoration extends RecyclerView.ItemDecoration { int itemCount = (int) Math.ceil((double) parent.getAdapter().getItemCount() / 5); + if (itemCount <= 1) { + return; + } + // center horizontally, calculate width and subtract half from center float totalLength = this.radius * 2 * itemCount; float paddingBetweenItems = Math.max(0, itemCount - 1) * indicatorItemPadding;