commit | 1f285a594a7ceccd2fbca011b96bd093da1dd179 | [log] [tgz] |
---|---|---|
author | Becky Qiu <xuqiu@google.com> | Fri May 06 16:22:50 2022 -0700 |
committer | Becky Qiu <xuqiu@google.com> | Fri May 06 21:48:54 2022 -0700 |
tree | d61a69da5397b7dcc4a77df8837508c8fb54a063 | |
parent | 8217fce33eb25dc22db2a6c16294372df6268750 [diff] |
Fix the IndexOutOfBoundsException in AllAppsGridAdapter. Bug: 231552223 Test: no need to test Change-Id: I2d32f0ca973e6e9d5e97d9c69b5c76d26d91c254
diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index 58df50c..33d2f2b 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java
@@ -118,7 +118,7 @@ List<AdapterItem> items = mApps.getAdapterItems(); adapterPosition = Math.max(adapterPosition, items.size() - 1); int extraRows = 0; - for (int i = 0; i <= adapterPosition; i++) { + for (int i = 0; i <= adapterPosition && i < items.size(); i++) { if (!isViewType(items.get(i).viewType, VIEW_TYPE_MASK_ICON)) { extraRows++; }