hbb20 / hbb20/CountryCodePickerProject

IndexOutOfBoundsException in getSectionTitle of CountryCodeAdapter

オープン
#619 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
1.5k
フォーク
509
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず CountryCodeAdapter.java、特に getSectionTitle と 202 行目付近の filteredCountries へのアクセスを読み、次に FastScroller.java が位置をどのように提供しているかを確認します。可能であればクラッシュを再現し、範囲外の位置で IndexOutOfBoundsException が発生しなくなったことと、有効な国のセクションでは引き続きタイトルが返されることを検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, java
領域
mobile
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。