Merge "AssetManager: Guard against null in array retrieval"
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
index af953e6..a044804 100644
--- a/core/java/android/content/res/AssetManager.java
+++ b/core/java/android/content/res/AssetManager.java
@@ -245,9 +245,12 @@
*
* @param resId the resource id of the string array
*/
- final CharSequence[] getResourceTextArray(@ArrayRes int resId) {
+ final @Nullable CharSequence[] getResourceTextArray(@ArrayRes int resId) {
synchronized (this) {
final int[] rawInfoArray = getArrayStringInfo(resId);
+ if (rawInfoArray == null) {
+ return null;
+ }
final int rawInfoArrayLen = rawInfoArray.length;
final int infoArrayLen = rawInfoArrayLen / 2;
int block;
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 636ad45..350675f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5033,7 +5033,7 @@
try {
rawHints = a.getTextArray(attr);
- } catch (NullPointerException e) {
+ } catch (Resources.NotFoundException e) {
rawString = getResources().getString(resId);
}
} else {