Skip to content

Empty carousel may lead to an ArithmeticException #6

@ripplemotion

Description

@ripplemotion

CarouselLayoutManager's translatePosition method may try to divide the position by zero as there are no item available. This would occur if a user tries to scroll on an empty carousel.

	public int translatePosition(int position) {
		if (!mInfinite) return position;
		int itemCount = getItemCount();
		**position %= itemCount**;
		if (position < 0) position += itemCount;
		return position;
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions