Fix a stack overflow when typing long words. Limit the size of auto-added words.
parent
63fa90a791
commit
81115075d2
|
@ -1169,6 +1169,9 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWord(String word, int addFrequency) {
|
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);
|
super.addWord(word, addFrequency);
|
||||||
final int freq = getWordFrequency(word);
|
final int freq = getWordFrequency(word);
|
||||||
if (freq > PROMOTION_THRESHOLD) {
|
if (freq > PROMOTION_THRESHOLD) {
|
||||||
|
|
Loading…
Reference in New Issue