diff options
| author | Alan Viverette <alanv@google.com> | 2015-06-01 10:45:49 -0700 |
|---|---|---|
| committer | Alan Viverette <alanv@google.com> | 2015-06-01 10:48:55 -0700 |
| commit | 50ba321fbcecd0b050d755ff5a02eba7ab97bb00 (patch) | |
| tree | 5468f48ea4e9b237945f41918a2797b7c66b45cf /core/java/android | |
| parent | 9be801c8269358ded8e4bed6103ca2346da7e179 (diff) | |
| download | frameworks_base-50ba321fbcecd0b050d755ff5a02eba7ab97bb00.zip frameworks_base-50ba321fbcecd0b050d755ff5a02eba7ab97bb00.tar.gz frameworks_base-50ba321fbcecd0b050d755ff5a02eba7ab97bb00.tar.bz2 | |
Prevent crash when ColorStateList has unresolved attrs
Bug: 21471789
Change-Id: Ieba6ab62b5e82eb716934a65efb6bfef2fc4e15a
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/content/res/ColorStateList.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java index 14bfac5..579634f 100644 --- a/core/java/android/content/res/ColorStateList.java +++ b/core/java/android/content/res/ColorStateList.java @@ -382,6 +382,14 @@ public class ColorStateList implements Parcelable { defaultAlphaMod = 1.0f; } + // Extract the theme attributes, if any, before attempting to + // read from the typed array. This prevents a crash if we have + // unresolved attrs. + themeAttrsList[i] = a.extractThemeAttrs(themeAttrsList[i]); + if (themeAttrsList[i] != null) { + hasUnresolvedAttrs = true; + } + final int baseColor = a.getColor( R.styleable.ColorStateListItem_color, mColors[i]); final float alphaMod = a.getFloat( @@ -391,12 +399,6 @@ public class ColorStateList implements Parcelable { // Account for any configuration changes. mChangingConfigurations |= a.getChangingConfigurations(); - // Extract the theme attributes, if any. - themeAttrsList[i] = a.extractThemeAttrs(themeAttrsList[i]); - if (themeAttrsList[i] != null) { - hasUnresolvedAttrs = true; - } - a.recycle(); } } |
