diff options
author | 2015-02-24 20:07:20 +0000 | |
---|---|---|
committer | 2015-02-24 20:07:20 +0000 | |
commit | 30a9af899f4025aa37942822ad69381cb3202e9b (patch) | |
tree | 900ec5b90cbabab1774fc49fddc45469870cc1f2 /java/src | |
parent | 57b2d854b303d922046653987ee453b4395d7732 (diff) | |
parent | edb2d2380214fa3a6d5416cc916f58360214d123 (diff) | |
download | latinime-30a9af899f4025aa37942822ad69381cb3202e9b.tar.gz latinime-30a9af899f4025aa37942822ad69381cb3202e9b.tar.xz latinime-30a9af899f4025aa37942822ad69381cb3202e9b.zip |
am edb2d238: Check for null TextRange in InputLogic.unlearnWordBeingDeleted
* commit 'edb2d2380214fa3a6d5416cc916f58360214d123':
Check for null TextRange in InputLogic.unlearnWordBeingDeleted
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java index 56be23f5b..c465f6c0b 100644 --- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java +++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java @@ -1094,8 +1094,8 @@ public final class InputLogic { int totalDeletedLength = 1; if (mDeleteCount > Constants.DELETE_ACCELERATE_AT) { // If this is an accelerated (i.e., double) deletion, then we need to - // consider unlearning here too because we may have just entered the - // previous word, and the next deletion will currupt it. + // consider unlearning here because we may have already reached + // the previous word, and will lose it after next deletion. hasUnlearnedWordBeingDeleted |= unlearnWordBeingDeleted( inputTransaction.mSettingsValues, currentKeyboardScriptId); sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL); @@ -1121,8 +1121,8 @@ public final class InputLogic { int totalDeletedLength = lengthToDelete; if (mDeleteCount > Constants.DELETE_ACCELERATE_AT) { // If this is an accelerated (i.e., double) deletion, then we need to - // consider unlearning here too because we may have just entered the - // previous word, and the next deletion will currupt it. + // consider unlearning here because we may have already reached + // the previous word, and will lose it after next deletion. hasUnlearnedWordBeingDeleted |= unlearnWordBeingDeleted( inputTransaction.mSettingsValues, currentKeyboardScriptId); final int codePointBeforeCursorToDeleteAgain = @@ -1166,6 +1166,11 @@ public final class InputLogic { final TextRange range = mConnection.getWordRangeAtCursor( settingsValues.mSpacingAndPunctuations, currentKeyboardScriptId); + if (range == null) { + // TODO(zivkovic): Check for bad connection before getting this far. + // Happens if we don't have an input connection at all. + return false; + } final String wordBeingDeleted = range.mWord.toString(); if (!wordBeingDeleted.isEmpty()) { unlearnWord(wordBeingDeleted, settingsValues, |