Fix an NPE in recapitalize
Bug: 8657736 Change-Id: I459d1c200826c1c394f8207475ecf60a4f356793
This commit is contained in:
parent
530fd15eff
commit
3bdf341ea0
1 changed files with 5 additions and 2 deletions
|
@ -1970,9 +1970,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
|||
// If we have a recapitalize in progress, use it; otherwise, create a new one.
|
||||
if (!mRecapitalizeStatus.isActive()
|
||||
|| !mRecapitalizeStatus.isSetAt(mLastSelectionStart, mLastSelectionEnd)) {
|
||||
final CharSequence selectedText =
|
||||
mConnection.getSelectedText(0 /* flags, 0 for no styles */);
|
||||
if (TextUtils.isEmpty(selectedText)) return; // Race condition with the input connection
|
||||
mRecapitalizeStatus.initialize(mLastSelectionStart, mLastSelectionEnd,
|
||||
mConnection.getSelectedText(0 /* flags, 0 for no styles */).toString(),
|
||||
mSettings.getCurrentLocale(), mSettings.getWordSeparators());
|
||||
selectedText.toString(), mSettings.getCurrentLocale(),
|
||||
mSettings.getWordSeparators());
|
||||
// We trim leading and trailing whitespace.
|
||||
mRecapitalizeStatus.trim();
|
||||
// Trimming the object may have changed the length of the string, and we need to
|
||||
|
|
Loading…
Reference in a new issue