From 65cf23eb38ee03237bbdfffb241b84e1bb8ed3dd Mon Sep 17 00:00:00 2001 From: Keisuke Kuroyanagi Date: Mon, 9 Jun 2014 12:26:59 +0900 Subject: [PATCH] Fix: NPE after turning on personalized suggestion. Bug: 13142176 Bug: 15428247 Change-Id: I236202e3c1b70a11d512c946798035087945c0ac --- .../android/inputmethod/latin/DictionaryFacilitator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java index 48b6a4622..bdf39238a 100644 --- a/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java +++ b/java/src/com/android/inputmethod/latin/DictionaryFacilitator.java @@ -574,6 +574,12 @@ public class DictionaryFacilitator { final ExpandableBinaryDictionary.AddMultipleDictionaryEntriesCallback callback) { final ExpandableBinaryDictionary personalizationDict = mDictionaries.getSubDict(Dictionary.TYPE_PERSONALIZATION); + if (personalizationDict == null) { + if (callback != null) { + callback.onFinished(); + } + return; + } final ArrayList languageModelParams = LanguageModelParam.createLanguageModelParamsFrom( personalizationDataChunk.mTokens, @@ -581,8 +587,7 @@ public class DictionaryFacilitator { this /* dictionaryFacilitator */, spacingAndPunctuations, new DistracterFilterCheckingIsInDictionary( mDistracterFilter, personalizationDict)); - if (personalizationDict == null || languageModelParams == null - || languageModelParams.isEmpty()) { + if (languageModelParams == null || languageModelParams.isEmpty()) { if (callback != null) { callback.onFinished(); }