Handle nullable drawables inside MaskableIconDrawable
Test: manual test
b/34902453
Change-Id: I36fc48f7e4c1f6503a9c26b8f239c62da729b490
diff --git a/graphics/java/android/graphics/drawable/MaskableIconDrawable.java b/graphics/java/android/graphics/drawable/MaskableIconDrawable.java
index 3467b1a..043f092 100644
--- a/graphics/java/android/graphics/drawable/MaskableIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/MaskableIconDrawable.java
@@ -726,6 +726,9 @@
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 @@
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;