Fix a stack overflow when typing long words. Limit the size of auto-added words.

main
Amith Yamasani 2009-08-03 17:47:44 -07:00 committed by Jean-Baptiste Queru
parent 63fa90a791
commit 81115075d2
1 changed files with 3 additions and 0 deletions

View File

@ -1169,6 +1169,9 @@ public class LatinIME extends InputMethodService
@Override
public void addWord(String word, int addFrequency) {
final int length = word.length();
// Don't add very short or very long words.
if (length < 2 || length > getMaxWordLength()) return;
super.addWord(word, addFrequency);
final int freq = getWordFrequency(word);
if (freq > PROMOTION_THRESHOLD) {