summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-06-05 17:19:30 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-05 17:20:41 +0000
commita06b41b06e5bbcf5bf02741a765ebad5367c14de (patch)
treeff474544b7768e7af9d7c923a59275433099df58
parent42cc892be135ed5be6f98f5f70bb6739bfaecaad (diff)
parent0f1c95edf8c14ad16b96f350b5507664fccc2ba0 (diff)
downloadframeworks_base-a06b41b06e5bbcf5bf02741a765ebad5367c14de.zip
frameworks_base-a06b41b06e5bbcf5bf02741a765ebad5367c14de.tar.gz
frameworks_base-a06b41b06e5bbcf5bf02741a765ebad5367c14de.tar.bz2
Merge "Avoid NPE when drawable fails to load" into mnc-dev
-rw-r--r--core/java/android/content/res/Resources.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index a572590..9a99a46 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -2486,7 +2486,8 @@ public class Resources {
return true;
}
- /*package*/ Drawable loadDrawable(TypedValue value, int id, Theme theme) throws NotFoundException {
+ @Nullable
+ Drawable loadDrawable(TypedValue value, int id, Theme theme) throws NotFoundException {
if (TRACE_FOR_PRELOAD) {
// Log only framework resources
if ((id >>> 24) == 0x1) {
@@ -2541,7 +2542,7 @@ public class Resources {
// Determine if the drawable has unresolved theme attributes. If it
// does, we'll need to apply a theme and store it in a theme-specific
// cache.
- final boolean canApplyTheme = dr.canApplyTheme();
+ final boolean canApplyTheme = dr != null && dr.canApplyTheme();
if (canApplyTheme && theme != null) {
dr = dr.mutate();
dr.applyTheme(theme);