Merge "Frameworks/base: Fix potential NPE in InputMethod"

This commit is contained in:
Andreas Gampe
2015-03-18 22:19:58 +00:00
committed by Gerrit Code Review

View File

@@ -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) {