Skip to content
New issue

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

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

Already on GitHub? # to your account

IndexOutOfBoundsException in getSectionTitle of CountryCodeAdapter #619

Open
freakdragon opened this issue Feb 19, 2025 · 1 comment
Open

Comments

@freakdragon
Copy link

Fatal Exception: java.lang.IndexOutOfBoundsException
Index: 253, Size: 253
java.util.ArrayList.get (ArrayList.java:437)
com.hbb20.CountryCodeAdapter.getSectionTitle (CountryCodeAdapter.java:1)

Sometimes FastScroller.java crashes app. It will be better to check the length of filteredCountries before get CCPCountry in this line

CCPCountry ccpCountry = filteredCountries.get(position); (202 line of CountryCodeAdapter class)

For example like this:

    public String getSectionTitle(int position) {
        if (preferredCountriesCount > position) {
            return "★";
        } else if (filteredCountries.size() > position) {
            return filteredCountries.get(position).getName().substring(0, 1);
        } else {
            return ""; //this should never be the case but it does
        }
    }
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@freakdragon and others