Fix NPE in getLastInputMethodSubtype
Bug: 4991393 Change-Id: I4ced2a2ca4815c7cee84a72dc6131fb8c4ee7216
This commit is contained in:
@@ -1623,8 +1623,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
if (lastImi == null) return null;
|
||||
try {
|
||||
final int lastSubtypeHash = Integer.valueOf(lastIme.second);
|
||||
return lastImi.getSubtypeAt(getSubtypeIdFromHashCode(
|
||||
lastImi, lastSubtypeHash));
|
||||
final int lastSubtypeId = getSubtypeIdFromHashCode(lastImi, lastSubtypeHash);
|
||||
if (lastSubtypeId < 0 || lastSubtypeId >= lastImi.getSubtypeCount()) {
|
||||
return null;
|
||||
}
|
||||
return lastImi.getSubtypeAt(lastSubtypeId);
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user