mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
IndexOutOfBoundsException 修正
This commit is contained in:
parent
87099ae693
commit
32b238df58
|
@ -94,9 +94,12 @@ public class HomeTopFragment extends Fragment {
|
|||
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
lacertaLibrary.getRecentDocument(10).thenAccept(listItems -> {
|
||||
if (listItems == null) {
|
||||
return;
|
||||
}
|
||||
listItemAdapter.setListItems(listItems);
|
||||
getActivity().runOnUiThread(() -> {
|
||||
listItemAdapter.notifyItemRangeInserted(0, listItems.size());
|
||||
listItemAdapter.notifyItemRangeInserted(0, listItems.size() - 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class ListItemAdapter extends RecyclerView.Adapter<ListItemAdapter.ListIt
|
|||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listItems.size();
|
||||
return listItems == null ? 0 : listItems.size();
|
||||
}
|
||||
|
||||
public static class ListItemViewHolder extends RecyclerView.ViewHolder{
|
||||
|
|
Loading…
Reference in New Issue
Block a user