summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hyunyoung Song <hyunyoungs@google.com> 2017-04-03 00:23:49 -0700
committer Hyunyoung Song <hyunyoungs@google.com> 2017-04-03 00:23:49 -0700
commit55211c032c1b47c38fa6ec741cb71e6b0ebca95c (patch)
tree6752ba4e055f460bc6fef87859bd967d029a532b
parent21a5edcc24cbca1ae3f0855d71737b22ab81ad6d (diff)
Prevent NPE when draw is called without bounds being set
Test: unit test inside AdaptiveIconDrawableTest.java Change-Id: Ic3260ce9c6bae595c7eba7be1cd7ae249939a1cf
-rw-r--r--graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
index c6c92714d1cc..643c0dab0635 100644
--- a/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
+++ b/graphics/java/android/graphics/drawable/AdaptiveIconDrawable.java
@@ -304,6 +304,9 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
@Override
public void draw(Canvas canvas) {
+ if (mLayersBitmap == null) {
+ return;
+ }
if (mLayersShader == null) {
mCanvas.setBitmap(mLayersBitmap);
for (int i = 0; i < mLayerState.N_CHILDREN; i++) {