diff options
author | Alan Viverette <alanv@google.com> | 2014-06-03 10:13:22 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-06-03 10:13:22 -0700 |
commit | 7a98f74438ac8da8bed5ebdb54c70ce24557a9d8 (patch) | |
tree | 6b46b2a06f42865fc93643568d6b8a846812bee6 /graphics | |
parent | 6fbe3982b035c200543454bb29b9f3e33b5e347a (diff) | |
download | frameworks_base-7a98f74438ac8da8bed5ebdb54c70ce24557a9d8.zip frameworks_base-7a98f74438ac8da8bed5ebdb54c70ce24557a9d8.tar.gz frameworks_base-7a98f74438ac8da8bed5ebdb54c70ce24557a9d8.tar.bz2 |
Fix NPE when ripples are canceled due to visibility change
BUG: 15406248
Change-Id: I63ce42fef8e1614372ee4a82e45eb15e8bbe1fe3
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/RippleDrawable.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java index 9d7a8b6..543f4fb 100644 --- a/graphics/java/android/graphics/drawable/RippleDrawable.java +++ b/graphics/java/android/graphics/drawable/RippleDrawable.java @@ -441,8 +441,11 @@ public class RippleDrawable extends LayerDrawable { final int count = mAnimatingRipplesCount; final Ripple[] ripples = mAnimatingRipples; for (int i = 0; i < count; i++) { - ripples[i].cancel(); + // Calling cancel may remove the ripple from the animating ripple + // array, so cache the reference before nulling it out. + final Ripple ripple = ripples[i]; ripples[i] = null; + ripple.cancel(); } mAnimatingRipplesCount = 0; |