diff options
| author | Kenny Root <kroot@google.com> | 2011-06-16 02:30:37 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-16 02:30:37 -0700 |
| commit | 9266847e6b666c1f43a08fb18a4f8dd78d9ce66c (patch) | |
| tree | c3e3e5cf0599ad1865e18ab4e38c6c299c2cf8a8 /core/java/android | |
| parent | df60dc327f165ae145755d3b721f1230c4a17106 (diff) | |
| parent | 49e3b372ab288992a4705dfe7f37fbd732d06aed (diff) | |
| download | frameworks_base-9266847e6b666c1f43a08fb18a4f8dd78d9ce66c.zip frameworks_base-9266847e6b666c1f43a08fb18a4f8dd78d9ce66c.tar.gz frameworks_base-9266847e6b666c1f43a08fb18a4f8dd78d9ce66c.tar.bz2 | |
Merge "Fix crash determining direction of invalid locale"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/util/LocaleUtil.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/util/LocaleUtil.java b/core/java/android/util/LocaleUtil.java index 4511d94..e767a85 100644 --- a/core/java/android/util/LocaleUtil.java +++ b/core/java/android/util/LocaleUtil.java @@ -71,8 +71,9 @@ public class LocaleUtil { if (localeWithSubtags == null) return getLayoutDirectionFromFirstChar(locale); // Need to check if we can extract the script subtag. For example, "Latn" in "en_Latn_US" - if (localeWithSubtags.charAt(2) != UNDERSCORE_CHAR || - localeWithSubtags.charAt(7) != UNDERSCORE_CHAR) { + if (localeWithSubtags.length() <= 7 + || localeWithSubtags.charAt(2) != UNDERSCORE_CHAR + || localeWithSubtags.charAt(7) != UNDERSCORE_CHAR) { return getLayoutDirectionFromFirstChar(locale); } // Extract the script subtag |
