hbb20 / hbb20/CountryCodePickerProject
IndexOutOfBoundsException in getSectionTitle of CountryCodeAdapter
- Lenguaje dominante
- Java
- Estrellas
- 1.5k
- Forks
- 509
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
```
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
}
}
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Empieza leyendo CountryCodeAdapter.java, especialmente getSectionTitle y el acceso a filteredCountries alrededor de la línea 202; después, inspecciona cómo FastScroller.java proporciona las posiciones. Reproduce el fallo si es posible y verifica que las posiciones fuera de rango ya no lancen una IndexOutOfBoundsException, mientras que las secciones de países válidas sigan devolviendo sus títulos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- android, java
- Área
- mobile
- Tipo de issue
- Error
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 48/100