From d98c20b036ff02f99406dabb8cc4fdf4a51cd6c4 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 12 Nov 2010 15:26:54 -0800 Subject: [PATCH] Fix NPE that is caused by null EditorInfo Bug: 3192772 Change-Id: Ia057d29e070ccbb90ee60df1e141de14de95f820 --- java/src/com/android/inputmethod/latin/LatinIME.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 707821125..e0ce9c9c5 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -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();