Fix NPE
Change-Id: Ib9a000ead8be91fab815dda161fcb258f678c3f4
This commit is contained in:
parent
0da235208e
commit
1f050f6348
1 changed files with 3 additions and 1 deletions
|
@ -1553,7 +1553,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
// a magic space even if it was a normal space. This is meant to help in case the user
|
// a magic space even if it was a normal space. This is meant to help in case the user
|
||||||
// pressed space on purpose of displaying the suggestion strip punctuation.
|
// pressed space on purpose of displaying the suggestion strip punctuation.
|
||||||
final char primaryCode = suggestion.charAt(0);
|
final char primaryCode = suggestion.charAt(0);
|
||||||
final int toLeft = (ic == null) ? 0 : ic.getTextBeforeCursor(1, 0).charAt(0);
|
final CharSequence beforeText = ic.getTextBeforeCursor(1, 0);
|
||||||
|
final int toLeft = (ic == null || TextUtils.isEmpty(beforeText))
|
||||||
|
? 0 : beforeText.charAt(0);
|
||||||
final boolean oldMagicSpace = mJustAddedMagicSpace;
|
final boolean oldMagicSpace = mJustAddedMagicSpace;
|
||||||
if (Keyboard.CODE_SPACE == toLeft) mJustAddedMagicSpace = true;
|
if (Keyboard.CODE_SPACE == toLeft) mJustAddedMagicSpace = true;
|
||||||
onCodeInput(primaryCode, new int[] { primaryCode },
|
onCodeInput(primaryCode, new int[] { primaryCode },
|
||||||
|
|
Loading…
Reference in a new issue