Add null check in createDistracterFilter().

Change-Id: Iff2b73081d48f32b1d3a5d5b32c9734979362c23
This commit is contained in:
Keisuke Kuroyanagi 2014-04-25 13:36:46 -07:00
parent 516c884b11
commit 169acbf9f0

View file

@ -543,7 +543,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private DistracterFilter createDistracterFilter() { private DistracterFilter createDistracterFilter() {
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
final Keyboard keyboard = mainKeyboardView.getKeyboard(); // TODO: Create Keyboard when mainKeyboardView is null.
// TODO: Figure out the most reasonable keyboard for the filter. Refer to the
// spellchecker's logic.
final Keyboard keyboard = (mainKeyboardView != null) ?
mainKeyboardView.getKeyboard() : null;
final DistracterFilter distracterFilter = new DistracterFilter(mInputLogic.mSuggest, final DistracterFilter distracterFilter = new DistracterFilter(mInputLogic.mSuggest,
keyboard); keyboard);
return distracterFilter; return distracterFilter;