am e5cbdfe1: am 3629605b: am 77226ed0: Merge "Fix an NPE in recapitalize" into jb-mr2-dev
* commit 'e5cbdfe1b83032c6ea212dd95c3968c522baa1d1': Fix an NPE in recapitalizemain
commit
b7abaafec0
|
@ -1976,9 +1976,12 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
// If we have a recapitalize in progress, use it; otherwise, create a new one.
|
// If we have a recapitalize in progress, use it; otherwise, create a new one.
|
||||||
if (!mRecapitalizeStatus.isActive()
|
if (!mRecapitalizeStatus.isActive()
|
||||||
|| !mRecapitalizeStatus.isSetAt(mLastSelectionStart, mLastSelectionEnd)) {
|
|| !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,
|
mRecapitalizeStatus.initialize(mLastSelectionStart, mLastSelectionEnd,
|
||||||
mConnection.getSelectedText(0 /* flags, 0 for no styles */).toString(),
|
selectedText.toString(), mSettings.getCurrentLocale(),
|
||||||
mSettings.getCurrentLocale(), mSettings.getWordSeparators());
|
mSettings.getWordSeparators());
|
||||||
// We trim leading and trailing whitespace.
|
// We trim leading and trailing whitespace.
|
||||||
mRecapitalizeStatus.trim();
|
mRecapitalizeStatus.trim();
|
||||||
// Trimming the object may have changed the length of the string, and we need to
|
// Trimming the object may have changed the length of the string, and we need to
|
||||||
|
|
Loading…
Reference in New Issue