Don't crash when list of chapters changes while binding

This commit is contained in:
ByteHamster 2021-03-07 20:03:45 +01:00
parent 0172a5db13
commit 5429d858ef
1 changed files with 4 additions and 0 deletions

View File

@ -53,6 +53,10 @@ public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapte
@Override
public void onBindViewHolder(@NonNull ChapterHolder holder, int position) {
Chapter sc = getItem(position);
if (sc == null) {
holder.title.setText("Error");
return;
}
holder.title.setText(sc.getTitle());
holder.start.setText(Converter.getDurationStringLong((int) sc
.getStart()));