diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 2cb943d7d..6d5d151f8 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -297,9 +297,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc * the previous tab page. */ protected void updateCurrentPageScroll() { - int offset = getChildOffset(mCurrentPage); - int relOffset = getRelativeChildOffset(mCurrentPage); - int newX = offset - relOffset; + // If the current page is invalid, just reset the scroll position to zero + int newX = 0; + if (0 <= mCurrentPage && mCurrentPage < getPageCount()) { + int offset = getChildOffset(mCurrentPage); + int relOffset = getRelativeChildOffset(mCurrentPage); + newX = offset - relOffset; + } scrollTo(newX, 0); mScroller.setFinalX(newX); mScroller.forceFinished(true); |