diff options
author | 2012-09-04 02:38:31 -0700 | |
---|---|---|
committer | 2012-09-04 02:38:31 -0700 | |
commit | f5e59e12c41337d1b3f9a967d79c9539bd52b907 (patch) | |
tree | 2b1a8e068ad617e4c64fadc5bc13e385607bdcec /java/src | |
parent | 37183c889c19d93ddbf4a3d29cfa1dd0b557de7f (diff) | |
parent | 2e4713a54ed38a18f39ef0d52431459c8210dc40 (diff) | |
download | latinime-f5e59e12c41337d1b3f9a967d79c9539bd52b907.tar.gz latinime-f5e59e12c41337d1b3f9a967d79c9539bd52b907.tar.xz latinime-f5e59e12c41337d1b3f9a967d79c9539bd52b907.zip |
am 2e4713a5: Merge "Check the length of the word when add to userhistory." into jb-mr1-dev
* commit '2e4713a54ed38a18f39ef0d52431459c8210dc40':
Check the length of the word when add to userhistory.
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/UserHistoryDictionary.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java index 6c9d1c250..683ee4f5c 100644 --- a/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java +++ b/java/src/com/android/inputmethod/latin/UserHistoryDictionary.java @@ -182,6 +182,10 @@ public class UserHistoryDictionary extends ExpandableDictionary { * The second word may not be null (a NullPointerException would be thrown). */ public int addToUserHistory(final String word1, String word2, boolean isValid) { + if (word2.length() >= BinaryDictionary.MAX_WORD_LENGTH || + (word1 != null && word1.length() >= BinaryDictionary.MAX_WORD_LENGTH)) { + return -1; + } if (mBigramListLock.tryLock()) { try { super.addWord( |