Fix NPE that is caused by null EditorInfo

Bug: 3192772
Change-Id: Ia057d29e070ccbb90ee60df1e141de14de95f820
main
Tadashi G. Takaoka 2010-11-12 15:26:54 -08:00
parent 6a567370ce
commit d98c20b036
1 changed files with 4 additions and 2 deletions

View File

@ -513,7 +513,8 @@ public class LatinIME extends InputMethodService
mOrientation = conf.orientation;
final int mode = mKeyboardSwitcher.getKeyboardMode();
final EditorInfo attribute = getCurrentInputEditorInfo();
mKeyboardSwitcher.loadKeyboard(mode, attribute.imeOptions, mVoiceButtonEnabled,
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
mKeyboardSwitcher.loadKeyboard(mode, imeOptions, mVoiceButtonEnabled,
mVoiceButtonOnPrimary);
}
@ -2273,7 +2274,8 @@ public class LatinIME extends InputMethodService
}
final int mode = mKeyboardSwitcher.getKeyboardMode();
final EditorInfo attribute = getCurrentInputEditorInfo();
mKeyboardSwitcher.loadKeyboard(mode, attribute.imeOptions, mVoiceButtonEnabled,
final int imeOptions = (attribute != null) ? attribute.imeOptions : 0;
mKeyboardSwitcher.loadKeyboard(mode, imeOptions, mVoiceButtonEnabled,
mVoiceButtonOnPrimary);
initSuggest(mLanguageSwitcher.getInputLanguage());
mLanguageSwitcher.persist();