From dffbb4dbceb7e90e91b65d02dfdbd1abd6147b94 Mon Sep 17 00:00:00 2001 From: Mitsuru Oshima Date: Wed, 29 Apr 2009 17:13:46 -0700 Subject: AI 148024: fix NPE when there is no history Automated import of CL 148024 --- core/java/android/view/MotionEvent.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java index 24026601145e..0d5567908af8 100644 --- a/core/java/android/view/MotionEvent.java +++ b/core/java/android/view/MotionEvent.java @@ -225,10 +225,12 @@ public final class MotionEvent implements Parcelable { mSize *= scale; mXPrecision *= scale; mYPrecision *= scale; - float[] history = mHistory; - int length = history.length; - for (int i = 0; i < length; i++) { - history[i] *= scale; + if (mHistory != null) { + float[] history = mHistory; + int length = history.length; + for (int i = 0; i < length; i++) { + history[i] *= scale; + } } } } -- cgit v1.2.3-59-g8ed1b