Skip to content
Snippets Groups Projects
Commit 2cf265b3 authored by Satoshi Kataoka's avatar Satoshi Kataoka Committed by Android (Google) Code Review
Browse files

Merge "Fix possible NPE from a concurrent problem in LatinIME"

parents e6a39d56 67b9337b
No related branches found
No related tags found
No related merge requests found
...@@ -1957,7 +1957,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen ...@@ -1957,7 +1957,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// expect to receive non-words. // expect to receive non-words.
if (!mCurrentSettings.mCorrectionEnabled) return null; if (!mCurrentSettings.mCorrectionEnabled) 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;
...@@ -1972,7 +1973,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen ...@@ -1972,7 +1973,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;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment