From 3084ec2df4f14684d11ca1006f8f243243071730 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Thu, 2 Feb 2017 00:53:06 -0800 Subject: [PATCH] Handle nullable drawables inside MaskableIconDrawable Test: manual test b/34902453 Change-Id: I36fc48f7e4c1f6503a9c26b8f239c62da729b490 --- .../android/graphics/drawable/MaskableIconDrawable.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/graphics/java/android/graphics/drawable/MaskableIconDrawable.java b/graphics/java/android/graphics/drawable/MaskableIconDrawable.java index 3467b1a789e74..043f0926bdb7a 100644 --- a/graphics/java/android/graphics/drawable/MaskableIconDrawable.java +++ b/graphics/java/android/graphics/drawable/MaskableIconDrawable.java @@ -726,6 +726,9 @@ public class MaskableIconDrawable extends Drawable implements Drawable.Callback int width = -1; for (int i = 0; i < mLayerState.N_CHILDREN; i++) { final ChildDrawable r = mLayerState.mChildren[i]; + if (r.mDrawable == null) { + continue; + } final int w = r.mDrawable.getIntrinsicWidth(); if (w > width) { width = w; @@ -743,6 +746,9 @@ public class MaskableIconDrawable extends Drawable implements Drawable.Callback int height = -1; for (int i = 0; i < mLayerState.N_CHILDREN; i++) { final ChildDrawable r = mLayerState.mChildren[i]; + if (r.mDrawable == null) { + continue; + } final int h = r.mDrawable.getIntrinsicHeight(); if (h > height) { height = h;