diff options
author | 2012-06-01 11:22:39 +0900 | |
---|---|---|
committer | 2012-06-01 12:19:22 +0900 | |
commit | 4f96bb4520de3610ae94da96b98e507ca7b76362 (patch) | |
tree | e3ad1f33100e296d1d16458349a714aaf55a0a50 /java/src | |
parent | 6f0cd9ba6df3f254d4f5bfc5ac11e354e858b713 (diff) | |
download | latinime-4f96bb4520de3610ae94da96b98e507ca7b76362.tar.gz latinime-4f96bb4520de3610ae94da96b98e507ca7b76362.tar.xz latinime-4f96bb4520de3610ae94da96b98e507ca7b76362.zip |
Fix NPE in user history bigram dictionary
Bug: 6584882
Change-Id: Id0162bffc4f0f36239cdc68383f8a47d7a957397
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 38549436b..695bf8dce 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -454,6 +454,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Has to be package-visible for unit tests /* package */ void loadSettings() { + // Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged() + // is not guaranteed. It may even be called at the same time on a different thread. if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); final RunInLocale<SettingsValues> job = new RunInLocale<SettingsValues>() { @Override @@ -495,6 +497,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen resetContactsDictionary(oldContactsDictionary); + // Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged() + // is not guaranteed. It may even be called at the same time on a different thread. + if (null == mPrefs) mPrefs = PreferenceManager.getDefaultSharedPreferences(this); mUserHistoryDictionary = new UserHistoryDictionary( this, localeStr, Suggest.DIC_USER_HISTORY, mPrefs); mSuggest.setUserHistoryDictionary(mUserHistoryDictionary); @@ -624,6 +629,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen @Override public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) { + // Note that the calling sequence of onCreate() and onCurrentInputMethodSubtypeChanged() + // is not guaranteed. It may even be called at the same time on a different thread. mSubtypeSwitcher.updateSubtype(subtype); } |