hbb20 / hbb20/CountryCodePickerProject

IndexOutOfBoundsException in getSectionTitle of CountryCodeAdapter

Aperta
#619 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1.5k
Fork
509
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

```
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
}
}
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.