Adding null check when creating icon bitmap

Bug: 24299267
Change-Id: I596e4a8dbd4e45cffff75e6cf7bbbf7ec45c8ec9
This commit is contained in:
Sunny Goyal
2015-09-23 12:56:51 -07:00
parent 8ac727b2c6
commit de9590be4c

View File

@@ -208,7 +208,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());
}
}