diff options
author | 2014-02-24 16:52:55 +0900 | |
---|---|---|
committer | 2014-02-24 16:52:55 +0900 | |
commit | f19745728e7231ffc8d7774b32821f31473ce1be (patch) | |
tree | eefefc51498a60bc6f81ac1b2802470887e24bb7 /java/src/com/android/inputmethod/latin/RichInputConnection.java | |
parent | 2b72aa07a9ac952e5d28cf657632e8d31d247baf (diff) | |
download | latinime-f19745728e7231ffc8d7774b32821f31473ce1be.tar.gz latinime-f19745728e7231ffc8d7774b32821f31473ce1be.tar.xz latinime-f19745728e7231ffc8d7774b32821f31473ce1be.zip |
Never pass negative values to setSelection.
Bug: 13136079
Change-Id: Ieae6bafbd5339a033f0f342ba9af7dcc4ce209fa
Diffstat (limited to 'java/src/com/android/inputmethod/latin/RichInputConnection.java')
-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) { |