aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-19 07:01:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-04-19 07:01:10 +0000
commit77226ed006ba32228cd5db19031e04d13d87b27e (patch)
tree47c10baa0763e157e85675a668afabfd3b734e22 /java/src
parent1844bec2024859f1c8dbc331893a74d5af9152d8 (diff)
parent3bdf341ea001cef70da803749e17484d19a9726a (diff)
downloadlatinime-77226ed006ba32228cd5db19031e04d13d87b27e.tar.gz
latinime-77226ed006ba32228cd5db19031e04d13d87b27e.tar.xz
latinime-77226ed006ba32228cd5db19031e04d13d87b27e.zip
Merge "Fix an NPE in recapitalize" into jb-mr2-dev
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