diff options
author | Romain Guy <romainguy@android.com> | 2009-05-29 12:28:23 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-05-29 12:28:23 -0700 |
commit | 9ffe1ae56bf495b1ada1e9c1da523db0677d98b7 (patch) | |
tree | dc95d38419e42c5ca094035ba2de5ab500482519 | |
parent | d9cc7659fa9b8544e2a3ca7b7040fbd79afdf7ea (diff) | |
download | frameworks_base-9ffe1ae56bf495b1ada1e9c1da523db0677d98b7.zip frameworks_base-9ffe1ae56bf495b1ada1e9c1da523db0677d98b7.tar.gz frameworks_base-9ffe1ae56bf495b1ada1e9c1da523db0677d98b7.tar.bz2 |
Fix for #1878497.
Always pre-allocate a gesture's bounding box to avoid possible NPEs.
-rwxr-xr-x | core/java/android/gesture/Gesture.java | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/core/java/android/gesture/Gesture.java b/core/java/android/gesture/Gesture.java index 6aca105..8e71c57 100755 --- a/core/java/android/gesture/Gesture.java +++ b/core/java/android/gesture/Gesture.java @@ -46,7 +46,7 @@ public class Gesture implements Parcelable { private static int sGestureCount = 0; - private RectF mBoundingBox; + private final RectF mBoundingBox = new RectF(); // the same as its instance ID private long mGestureID; @@ -83,12 +83,7 @@ public class Gesture implements Parcelable { */ public void addStroke(GestureStroke stroke) { mStrokes.add(stroke); - - if (mBoundingBox == null) { - mBoundingBox = new RectF(stroke.boundingBox); - } else { - mBoundingBox.union(stroke.boundingBox); - } + mBoundingBox.union(stroke.boundingBox); } /** |