From 9ac291bad6edb745d68aab9baf0465c3323d8e4e Mon Sep 17 00:00:00 2001 From: d34d Date: Thu, 17 Mar 2016 09:38:12 -0700 Subject: v4: Assign mDrawable before calling setBounds In setWrappedDrawable, mDrawable is set to null which can cause an NPE when onBoundsChange is called. This happens when setBounds is called before mDrawable has been reassigned to the new drawable to wrap. Change-Id: I0cdd7c68c6f1156b5429cb9731ce1e25928be9d9 TICKET: CYNGNOS-2250 --- .../android/support/v4/graphics/drawable/DrawableWrapperDonut.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/v4/donut/android/support/v4/graphics/drawable/DrawableWrapperDonut.java b/v4/donut/android/support/v4/graphics/drawable/DrawableWrapperDonut.java index 300e2e8ce1..67a76c442c 100644 --- a/v4/donut/android/support/v4/graphics/drawable/DrawableWrapperDonut.java +++ b/v4/donut/android/support/v4/graphics/drawable/DrawableWrapperDonut.java @@ -245,20 +245,15 @@ class DrawableWrapperDonut extends Drawable implements Drawable.Callback, Drawab if (mDrawable != null) { mDrawable.setCallback(null); } - mDrawable = null; + mDrawable = drawable; if (drawable != null) { // Copy over the bounds from the drawable setBounds(drawable.getBounds()); // Set ourselves as the callback for invalidations drawable.setCallback(this); - } else { - // Clear our bounds - setBounds(0, 0, 0, 0); } - mDrawable = drawable; - // Invalidate ourselves invalidateSelf(); } -- cgit v1.2.3