summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2011-06-16 02:30:37 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-16 02:30:37 -0700
commit9266847e6b666c1f43a08fb18a4f8dd78d9ce66c (patch)
treec3e3e5cf0599ad1865e18ab4e38c6c299c2cf8a8 /core/java/android
parentdf60dc327f165ae145755d3b721f1230c4a17106 (diff)
parent49e3b372ab288992a4705dfe7f37fbd732d06aed (diff)
downloadframeworks_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.java5
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