Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77226ed0 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Fix an NPE in recapitalize" into jb-mr2-dev

parents 1844bec2 3bdf341e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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