nullの場合は0を返すように

This commit is contained in:
ろむねこ 2024-01-22 10:20:38 +09:00
parent 3130be88be
commit 93b833f7a9
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -21,8 +21,8 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
DocumentSelectListener listener; DocumentSelectListener listener;
public ListItemAdapter(DocumentSelectListener listener){
this.libraryItemPage = new LibraryItemPage(); public ListItemAdapter(DocumentSelectListener listener) {
this.listener = listener; this.listener = listener;
} }
@ -54,7 +54,8 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
@Override @Override
public int getItemCount() { public int getItemCount() {
return libraryItemPage.getListItems().size(); return this.libraryItemPage == null ? 0
: this.libraryItemPage.getListItems() == null ? 0 : this.libraryItemPage.getListItems().size();
} }
public static class ListItemViewHolder extends RecyclerView.ViewHolder{ public static class ListItemViewHolder extends RecyclerView.ViewHolder{