Skip to content
Snippets Groups Projects
Commit a09b9cea authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by Android (Google) Code Review
Browse files

Merge "Fix: NPE after onDestroy()."

parents 2f781026 30cd0cd2
No related branches found
No related tags found
No related merge requests found
......@@ -269,6 +269,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
}
private void runGCAfterAllPrioritizedTasksIfRequiredLocked(final boolean mindsBlockByGC) {
if (mBinaryDictionary == null) {
return;
}
// needsToRunGC() have to be called with lock.
if (mBinaryDictionary.needsToRunGC(mindsBlockByGC)) {
if (setProcessingLargeTaskIfNot()) {
......@@ -357,6 +360,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
public void run() {
final boolean locked = setProcessingLargeTaskIfNot();
try {
if (mBinaryDictionary == null) {
return;
}
mBinaryDictionary.addMultipleDictionaryEntries(
languageModelParams.toArray(
new LanguageModelParam[languageModelParams.size()]));
......@@ -496,6 +502,9 @@ abstract public class ExpandableBinaryDictionary extends Dictionary {
}
private void flushDictionaryLocked() {
if (mBinaryDictionary == null) {
return;
}
if (mBinaryDictionary.needsToRunGC(false /* mindsBlockByGC */)) {
mBinaryDictionary.flushWithGC();
} else {
......
......@@ -110,6 +110,9 @@ public final class LanguageModelParam {
final LanguageModelParam languageModelParam =
detectWhetherVaildWordOrNotAndGetLanguageModelParam(
prevWord, tempWord, timestamp, dictionaryFacilitator);
if (languageModelParam == null) {
continue;
}
languageModelParams.add(languageModelParam);
prevWord = languageModelParam.mTargetWord;
}
......@@ -120,6 +123,9 @@ public final class LanguageModelParam {
final String prevWord, final String targetWord, final int timestamp,
final DictionaryFacilitatorForSuggest dictionaryFacilitator) {
final Locale locale = dictionaryFacilitator.getLocale();
if (locale == null) {
return null;
}
if (!dictionaryFacilitator.isValidWord(targetWord, true /* ignoreCase */)) {
// OOV word.
return createAndGetLanguageModelParamOfWord(prevWord, targetWord, timestamp,
......
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