am de9590be: Adding null check when creating icon bitmap

* commit 'de9590be4ca2779ae0f7f64a48ac8b90472484f8':
  Adding null check when creating icon bitmap
This commit is contained in:
Sunny Goyal
2015-09-28 18:46:18 +00:00
committed by Android Git Automerger

View File

@@ -211,7 +211,7 @@ public final class Utilities {
// Ensure the bitmap has a density.
BitmapDrawable bitmapDrawable = (BitmapDrawable) icon;
Bitmap bitmap = bitmapDrawable.getBitmap();
if (bitmap.getDensity() == Bitmap.DENSITY_NONE) {
if (bitmap != null && bitmap.getDensity() == Bitmap.DENSITY_NONE) {
bitmapDrawable.setTargetDensity(context.getResources().getDisplayMetrics());
}
}