From 32b238df58bed3389d60bf116b0f1003b3872961 Mon Sep 17 00:00:00 2001 From: r-ca Date: Tue, 23 Jan 2024 03:24:34 +0900 Subject: [PATCH] =?UTF-8?q?IndexOutOfBoundsException=20=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/one/nem/lacerta/feature/home/HomeTopFragment.java | 5 ++++- .../java/one/nem/lacerta/feature/home/ListItemAdapter.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java index 396c1dba..8d3dcc84 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/HomeTopFragment.java @@ -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); }); }); } diff --git a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java index cf94a9e9..604ecf4b 100644 --- a/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java +++ b/feature/home/src/main/java/one/nem/lacerta/feature/home/ListItemAdapter.java @@ -54,7 +54,7 @@ public class ListItemAdapter extends RecyclerView.Adapter