OSDN Git Service

Check for null drawable in theme-less getDrawable()
authorAlan Viverette <alanv@google.com>
Mon, 24 Nov 2014 19:27:09 +0000 (11:27 -0800)
committerAlan Viverette <alanv@google.com>
Mon, 24 Nov 2014 19:27:09 +0000 (11:27 -0800)
BUG: 18507509
Change-Id: I64e2950dc3a30f3979ec179789a6f6e055c9f86d

core/java/android/content/res/Resources.java

index 0145e05..78d3e9c 100644 (file)
@@ -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());