diff options
| author | Alan Viverette <alanv@google.com> | 2015-06-05 10:17:21 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2015-06-05 10:17:21 -0700 |
| commit | 0f1c95edf8c14ad16b96f350b5507664fccc2ba0 (patch) | |
| tree | 32f84df2447f0c093af378eb705b5458d0f3ea9d /core/java/android/content/res | |
| parent | b0a5e78fc06aeb67ac1f55832c9ceef5f92a0807 (diff) | |
| download | frameworks_base-0f1c95edf8c14ad16b96f350b5507664fccc2ba0.zip frameworks_base-0f1c95edf8c14ad16b96f350b5507664fccc2ba0.tar.gz frameworks_base-0f1c95edf8c14ad16b96f350b5507664fccc2ba0.tar.bz2 | |
Avoid NPE when drawable fails to load
Bug: 17760671
Change-Id: I99364e915e318b3e49fc758811784939a937de7c
Diffstat (limited to 'core/java/android/content/res')
| -rw-r--r-- | core/java/android/content/res/Resources.java | 5 |
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); |
