Don't crash when list of chapters changes while binding
This commit is contained in:
parent
0172a5db13
commit
5429d858ef
@ -53,6 +53,10 @@ public class ChaptersListAdapter extends RecyclerView.Adapter<ChaptersListAdapte
|
|||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(@NonNull ChapterHolder holder, int position) {
|
public void onBindViewHolder(@NonNull ChapterHolder holder, int position) {
|
||||||
Chapter sc = getItem(position);
|
Chapter sc = getItem(position);
|
||||||
|
if (sc == null) {
|
||||||
|
holder.title.setText("Error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
holder.title.setText(sc.getTitle());
|
holder.title.setText(sc.getTitle());
|
||||||
holder.start.setText(Converter.getDurationStringLong((int) sc
|
holder.start.setText(Converter.getDurationStringLong((int) sc
|
||||||
.getStart()));
|
.getStart()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user