aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-19 00:04:13 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-19 00:04:13 -0700
commit3629605b7c14b5eea498ef9588f4fef788ef454c (patch)
treeec46885a6133296751aef995830486d168267829 /java/src
parentdcc59297ac97c2ae7791ab09c535927c93c607fb (diff)
parent77226ed006ba32228cd5db19031e04d13d87b27e (diff)
downloadlatinime-3629605b7c14b5eea498ef9588f4fef788ef454c.tar.gz
latinime-3629605b7c14b5eea498ef9588f4fef788ef454c.tar.xz
latinime-3629605b7c14b5eea498ef9588f4fef788ef454c.zip
am 77226ed0: Merge "Fix an NPE in recapitalize" into jb-mr2-dev
* commit '77226ed006ba32228cd5db19031e04d13d87b27e': Fix an NPE in recapitalize
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index efa51569f..4b58c5dc7 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -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