summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-05-24 16:36:16 (GMT)
committerStephen Bird <sbird@cyngn.com>2015-05-27 21:31:13 (GMT)
commitc42bdf92b00da631b0ed0d345ea6c280838629ae (patch)
tree16700eda0f20dd9c9ea7eedcbb659fd269421387
parentbbf808d921e01df02c273260a3e2ed67fa34551c (diff)
downloadandroid_packages_apps_Trebuchet-c42bdf92b00da631b0ed0d345ea6c280838629ae.zip
android_packages_apps_Trebuchet-c42bdf92b00da631b0ed0d345ea6c280838629ae.tar.gz
android_packages_apps_Trebuchet-c42bdf92b00da631b0ed0d345ea6c280838629ae.tar.bz2
Trebuchet: fix NPE during touch events
E/AndroidRuntime( 693): FATAL EXCEPTION: main E/AndroidRuntime( 693): java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getMeasuredWidth()' on a null object reference E/AndroidRuntime( 693): at com.android.launcher3.PagedView.onTouchEvent (PagedView.java:1986) Change-Id: Ica9395a1e2b2d28a1b074b40ff759eab68154ff0 (cherry picked from commit 16416d464bfad477d9fc3e1805154f2014954081)
-rw-r--r--src/com/android/launcher3/PagedView.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index b314bd1..cf4eb2a 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -1983,7 +1983,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocityX = (int) velocityTracker.getXVelocity(activePointerId);
final int deltaX = (int) (x - mDownMotionX);
- final int pageWidth = getPageAt(mCurrentPage).getMeasuredWidth();
+ final int pageWidth = getPageAt(mCurrentPage) != null ?
+ getPageAt(mCurrentPage).getMeasuredWidth() : 0;
boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
SIGNIFICANT_MOVE_THRESHOLD;