diff options
author | 2014-02-24 05:57:13 -0800 | |
---|---|---|
committer | 2014-02-24 05:57:13 -0800 | |
commit | 94393f057f98fc6bc3705b5ff027ed3ccbf91dcd (patch) | |
tree | bb46294f66d39a72e69ac9e8e5b96e3426f90f28 /java/src/com/android/inputmethod/latin | |
parent | 1ea83181b0e0c02c98e6221208c0af2f6c30b225 (diff) | |
parent | 65bce4cabc9d1a1e8087e9769311ac00f3888d0e (diff) | |
download | latinime-94393f057f98fc6bc3705b5ff027ed3ccbf91dcd.tar.gz latinime-94393f057f98fc6bc3705b5ff027ed3ccbf91dcd.tar.xz latinime-94393f057f98fc6bc3705b5ff027ed3ccbf91dcd.zip |
am 65bce4ca: Merge "Never pass negative values to setSelection."
* commit '65bce4cabc9d1a1e8087e9769311ac00f3888d0e':
Never pass negative values to setSelection.
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
-rw-r--r-- | java/src/com/android/inputmethod/latin/RichInputConnection.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java index 30b20a335..323256d1c 100644 --- a/java/src/com/android/inputmethod/latin/RichInputConnection.java +++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java @@ -483,12 +483,16 @@ public final class RichInputConnection { * * @param start the character index where the selection should start. * @param end the character index where the selection should end. - * @return Returns true on success, false if the input connection is no longer valid either when - * setting the selection or when retrieving the text cache at that point. + * @return Returns true on success, false on failure: either the input connection is no longer + * valid when setting the selection or when retrieving the text cache at that point, or + * invalid arguments were passed. */ public boolean setSelection(final int start, final int end) { if (DEBUG_BATCH_NESTING) checkBatchEdit(); if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug(); + if (start < 0 || end < 0) { + return false; + } mExpectedSelStart = start; mExpectedSelEnd = end; if (null != mIC) { |