Fix issue 3214208

-Doing an index check to avoid NPE

Change-Id: I53e4f4377f0e725e57ed9d0835b6f69af4f83a64
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index a2ed985..264e839 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -417,8 +417,12 @@
         if (heightMode == MeasureSpec.AT_MOST) {
             heightSize = maxChildHeight + verticalPadding;
         }
+        if (childCount > 0) {
+            mMaxScrollX = getChildOffset(childCount - 1) - getRelativeChildOffset(childCount - 1);
+        } else {
+            mMaxScrollX = 0;
+        }
 
-        mMaxScrollX = getChildOffset(childCount - 1) - getRelativeChildOffset(childCount - 1);
         setMeasuredDimension(widthSize, heightSize);
     }