diff options
author | 2013-10-09 20:59:53 -0700 | |
---|---|---|
committer | 2013-10-09 20:59:53 -0700 | |
commit | a3efde54d75f05145f1c4a085ef569e7c970fa7f (patch) | |
tree | d25bd320c1f61c4ae6b578083b9c9ced7987818e /java | |
parent | 322366d07ec2431ffc78767c37e58fd7c4a8aea3 (diff) | |
parent | 6e979246be424db462b594ad2a63b9f9841d39f8 (diff) | |
download | latinime-a3efde54d75f05145f1c4a085ef569e7c970fa7f.tar.gz latinime-a3efde54d75f05145f1c4a085ef569e7c970fa7f.tar.xz latinime-a3efde54d75f05145f1c4a085ef569e7c970fa7f.zip |
am 6e979246: am 7712baa5: Merge "Fix a possible IOOB"
* commit '6e979246be424db462b594ad2a63b9f9841d39f8':
Fix a possible IOOB
Diffstat (limited to 'java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java index be653feec..3bb218bea 100644 --- a/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java +++ b/java/src/com/android/inputmethod/latin/makedict/FusionDictionary.java @@ -367,10 +367,11 @@ public final class FusionDictionary implements Iterable<Word> { * Helper method to convert a String to an int array. */ static int[] getCodePoints(final String word) { - // TODO: this is a copy-paste of the contents of StringUtils.toCodePointArray, + // TODO: this is a copy-paste of the old contents of StringUtils.toCodePointArray, // which is not visible from the makedict package. Factor this code. + final int length = word.length(); + if (length <= 0) return new int[] {}; final char[] characters = word.toCharArray(); - final int length = characters.length; final int[] codePoints = new int[Character.codePointCount(characters, 0, length)]; int codePoint = Character.codePointAt(characters, 0); int dsti = 0; |