From 7e0aaae3db11e0f23dca8c4cddff261f0132266c Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Mon, 24 Nov 2014 11:27:09 -0800 Subject: [PATCH] Check for null drawable in theme-less getDrawable() BUG: 18507509 Change-Id: I64e2950dc3a30f3979ec179789a6f6e055c9f86d --- core/java/android/content/res/Resources.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 0145e05a86e4a..78d3e9cc9b255 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -747,7 +747,7 @@ public class Resources { */ public Drawable getDrawable(int id) throws NotFoundException { final Drawable d = getDrawable(id, null); - if (d.canApplyTheme()) { + if (d != null && d.canApplyTheme()) { Log.w(TAG, "Drawable " + getResourceName(id) + " has unresolved theme " + "attributes! Consider using Resources.getDrawable(int, Theme) or " + "Context.getDrawable(int).", new RuntimeException());