summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-17 21:07:21 -0700
committerAndreas Gampe <agampe@google.com>2015-03-17 21:07:21 -0700
commit4236ad7a2fe4a410571c4bad314b6168b1a4e836 (patch)
treefa26ee672de1bdedbc144932c390f3cc96fe64cc /core
parent28e6aeca3aad075ef4fd7aab08cd1ad1ff9eb555 (diff)
downloadframeworks_base-4236ad7a2fe4a410571c4bad314b6168b1a4e836.zip
frameworks_base-4236ad7a2fe4a410571c4bad314b6168b1a4e836.tar.gz
frameworks_base-4236ad7a2fe4a410571c4bad314b6168b1a4e836.tar.bz2
Frameworks/base: Fix potential NPE in InputMethod
Don't read the size of an unchecked list. Bug: 19797138 Change-Id: I9d8c087aff7bc9cc1e8aae9a0b489e23b5442765
Diffstat (limited to 'core')
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index 325ffdd..1416e1b 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -1993,8 +1993,8 @@ public final class InputMethodManager {
List<Object> info = mService.getShortcutInputMethodsAndSubtypes();
// "info" has imi1, subtype1, subtype2, imi2, subtype2, imi3, subtype3..in the list
ArrayList<InputMethodSubtype> subtypes = null;
- final int N = info.size();
- if (info != null && N > 0) {
+ if (info != null && !info.isEmpty()) {
+ final int N = info.size();
for (int i = 0; i < N; ++i) {
Object o = info.get(i);
if (o instanceof InputMethodInfo) {