diff --git a/core/java/android/content/res/StringBlock.java b/core/java/android/content/res/StringBlock.java index 0070a6f920db..5e84521714ee 100644 --- a/core/java/android/content/res/StringBlock.java +++ b/core/java/android/content/res/StringBlock.java @@ -105,7 +105,7 @@ public CharSequence get(int idx) { @Nullable public CharSequence getSequence(int idx) { synchronized (this) { - if (mStrings != null) { + if (mStrings != null && idx < mStrings.length) { CharSequence res = mStrings[idx]; if (res != null) { return res;