aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2012-09-04 02:38:31 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-09-04 02:38:31 -0700
commitf5e59e12c41337d1b3f9a967d79c9539bd52b907 (patch)
tree2b1a8e068ad617e4c64fadc5bc13e385607bdcec /java/src
parent37183c889c19d93ddbf4a3d29cfa1dd0b557de7f (diff)
parent2e4713a54ed38a18f39ef0d52431459c8210dc40 (diff)
downloadlatinime-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.java4
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(