am 3629605b: am 77226ed0: Merge "Fix an NPE in recapitalize" into jb-mr2-dev

* commit '3629605b7c14b5eea498ef9588f4fef788ef454c':
  Fix an NPE in recapitalize
main
Jean Chalard 2013-04-19 00:06:58 -07:00 committed by Android Git Automerger
commit e5cbdfe1b8
1 changed files with 5 additions and 2 deletions

View File

@ -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 (!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