From 9745de0f0559bccd7b4a2f80b5ff8c8f118c7bfc Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Mon, 18 Aug 2014 11:26:31 -0700 Subject: [PATCH] Fix BitmapDrawable outline crash bug:17103753 Change-Id: Ia3d2c7d61b3f3b9ea8879f941d726d8627e155bb --- graphics/java/android/graphics/drawable/BitmapDrawable.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java index 40adf94286bcc..e52d778b11879 100644 --- a/graphics/java/android/graphics/drawable/BitmapDrawable.java +++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java @@ -602,9 +602,9 @@ public class BitmapDrawable extends Drawable { @Override public void getOutline(@NonNull Outline outline) { super.getOutline(outline); - if (mBitmapState.mBitmap.hasAlpha()) { - // Bitmaps with alpha can't report a non-0 alpha, - // since they may not fill their rectangular bounds + if (mBitmapState.mBitmap == null || mBitmapState.mBitmap.hasAlpha()) { + // Only opaque Bitmaps can report a non-0 alpha, + // since only they are guaranteed to fill their bounds outline.setAlpha(0.0f); } }