commit | 532e6ea2e6e4b5f968038b52db9bb998cb9fe84a | [log] [tgz] |
---|---|---|
author | Winson Chung <winsonc@google.com> | Thu May 14 12:24:25 2015 -0700 |
committer | Winson Chung <winsonc@google.com> | Thu May 14 12:24:25 2015 -0700 |
tree | ff50fed3f71cefdba0f576d35fd8b74767022208 | |
parent | 02baa79e1f75f4c0cc9633d2e634a191321be316 [diff] |
Fixing crash when updating the scroll position state when there are no items. Change-Id: I2bee8dedb2e546c956b7d9ff36187fb75183bd35
diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java index 34e621a..3859be8 100644 --- a/src/com/android/launcher3/AppsContainerRecyclerView.java +++ b/src/com/android/launcher3/AppsContainerRecyclerView.java
@@ -497,6 +497,12 @@ stateOut.rowIndex = -1; stateOut.rowTopOffset = -1; stateOut.rowHeight = -1; + + // Return early if there are no items + if (items.isEmpty()) { + return; + } + int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i);