summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/InputMethodManagerService.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 60813f1f6d2a..e336a355b761 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -1526,13 +1526,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
mDialogBuilder.setSingleChoiceItems(mItems, checkedItem,
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- if (mIms == null) {
- return;
- }
synchronized (mMethodMap) {
+ if (mIms == null || mIms.length <= which) {
+ return;
+ }
InputMethodInfo im = mIms[which];
hideInputMethodMenu();
- setInputMethodLocked(im.getId());
+ if (im != null) {
+ setInputMethodLocked(im.getId());
+ }
}
}
});