Skip to content

Commit f1c0aed

Browse files
author
Dianne Hackborn
committed
Fix issue #6921726: Prime: Cannot make or receive phone calls...
[NPE at android.graphics.drawable.Drawable.createFromResourceStream] Change-Id: I223428ffb39e883518aad817227f32851ea18aec
1 parent 5345c31 commit f1c0aed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graphics/java/android/graphics/drawable/Drawable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,8 @@ public static Drawable createFromResourceStream(Resources res, TypedValue value,
778778
// to the compatibility density only to have them scaled back up when
779779
// drawn to the screen.
780780
if (opts == null) opts = new BitmapFactory.Options();
781-
opts.inScreenDensity = res.getDisplayMetrics().noncompatDensityDpi;
781+
opts.inScreenDensity = res != null
782+
? res.getDisplayMetrics().noncompatDensityDpi : DisplayMetrics.DENSITY_DEVICE;
782783
Bitmap bm = BitmapFactory.decodeResourceStream(res, value, is, pad, opts);
783784
if (bm != null) {
784785
byte[] np = bm.getNinePatchChunk();

0 commit comments

Comments
 (0)