From 1f1f45d6205400d74e15c3f6981f3b8899514bca Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Wed, 2 Oct 2013 09:40:18 -0700 Subject: Fix ArrayIndexOutOfBoundsException, (issue 11038649) Change-Id: Ib7aa55b104894f12175b382fdbcfb08d95408699 --- src/com/android/launcher3/PagedView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 0a15ecd62..03e24c693 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1050,7 +1050,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected void getOverviewModePages(int[] range) { range[0] = 0; - range[1] = getChildCount() - 1; + range[1] = Math.max(0, getChildCount() - 1); } protected void getVisiblePages(int[] range) { @@ -1475,7 +1475,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } public int getScrollForPage(int index) { - if (mPageScrolls == null || index >= mPageScrolls.length) { + if (mPageScrolls == null || index >= mPageScrolls.length || index < 0) { return 0; } else { return mPageScrolls[index]; -- cgit v1.2.3