例外workaround

This commit is contained in:
ろむねこ 2024-07-23 11:47:15 +09:00
parent 86093a1e13
commit f4b116cd27
Signed by: Fujimatsu
GPG Key ID: FA1F39A1BA37D168

View File

@ -1,5 +1,6 @@
package one.nem.kidshift.wallet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -172,10 +173,15 @@ public class HistoryItemListAdapter extends RecyclerView.Adapter<HistoryItemList
private int getMonthTotal(HistoryModel historyModel) {
int total = historyModel.getReward();
int index = historyDataList.getList().indexOf(historyModel) + 1;
try {
while (!isFirstOfMonth(this.historyDataList.getList().get(index))) {
total += historyModel.getReward();
index++;
}
} catch (IndexOutOfBoundsException e) {
// 1個しかない場合 Workaround
// TODO: 例外をひねり潰すのではなくそもそも発生しないようにするべき
}
return total;
}