mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix possible NPE from a concurrent problem in LatinIME
Bug: 6620746 Change-Id: Icc18de92d7edc6888c712c2cf5ce479a65f8bfad
This commit is contained in:
parent
d2f210dbe2
commit
67b9337b6c
@ -1971,7 +1971,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||||||
// want corrections enabled or learned.
|
// want corrections enabled or learned.
|
||||||
if (!mCurrentSettings.isCorrectionOn()) return null;
|
if (!mCurrentSettings.isCorrectionOn()) return null;
|
||||||
|
|
||||||
if (mUserHistoryDictionary != null) {
|
final UserHistoryDictionary userHistoryDictionary = mUserHistoryDictionary;
|
||||||
|
if (userHistoryDictionary != null) {
|
||||||
final CharSequence prevWord
|
final CharSequence prevWord
|
||||||
= mConnection.getPreviousWord(mCurrentSettings.mWordSeparators);
|
= mConnection.getPreviousWord(mCurrentSettings.mWordSeparators);
|
||||||
final String secondWord;
|
final String secondWord;
|
||||||
@ -1986,7 +1987,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||||||
final int maxFreq = AutoCorrection.getMaxFrequency(
|
final int maxFreq = AutoCorrection.getMaxFrequency(
|
||||||
mSuggest.getUnigramDictionaries(), suggestion);
|
mSuggest.getUnigramDictionaries(), suggestion);
|
||||||
if (maxFreq == 0) return null;
|
if (maxFreq == 0) return null;
|
||||||
mUserHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(),
|
userHistoryDictionary.addToUserHistory(null == prevWord ? null : prevWord.toString(),
|
||||||
secondWord, maxFreq > 0);
|
secondWord, maxFreq > 0);
|
||||||
return prevWord;
|
return prevWord;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user