aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2013-04-19 00:08:56 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-19 00:08:56 -0700
commitb7abaafec08f3c9f79b72a0f9d07784f84a68abe (patch)
tree2e47e52ff569a463cbef42a48daa97124cdb2567 /java
parentfc2ca29d71ef85a93170a7c5f2d61c084a694bb2 (diff)
parente5cbdfe1b83032c6ea212dd95c3968c522baa1d1 (diff)
downloadlatinime-b7abaafec08f3c9f79b72a0f9d07784f84a68abe.tar.gz
latinime-b7abaafec08f3c9f79b72a0f9d07784f84a68abe.tar.xz
latinime-b7abaafec08f3c9f79b72a0f9d07784f84a68abe.zip
am e5cbdfe1: am 3629605b: am 77226ed0: Merge "Fix an NPE in recapitalize" into jb-mr2-dev
* commit 'e5cbdfe1b83032c6ea212dd95c3968c522baa1d1': Fix an NPE in recapitalize
Diffstat (limited to 'java')
-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