diff options
author | Tom Taylor <tomtaylor@google.com> | 2013-03-26 12:22:56 -0700 |
---|---|---|
committer | Tom Taylor <tomtaylor@google.com> | 2013-03-26 12:22:56 -0700 |
commit | 4fc5c95c966615b971a8d67dc63b384ae691fb11 (patch) | |
tree | ecc8d7ff7962ee3e4b05161083e187a526ac460a | |
parent | 8f0f70c88a16f784deddfc1511503226b17798ca (diff) | |
download | android_frameworks_ex-4fc5c95c966615b971a8d67dc63b384ae691fb11.tar.gz android_frameworks_ex-4fc5c95c966615b971a8d67dc63b384ae691fb11.tar.bz2 android_frameworks_ex-4fc5c95c966615b971a8d67dc63b384ae691fb11.zip |
StringIndexOutOfBoundsException in Chips during monkey run
Bug 8478568
The code was looking for a comma and not finding one, but since the length
of the token was zero, the "if" clause was executed and tried to make
a substring of length -1.
Change-Id: Ic876fd6b5880c452b27083fb23cf78da994e0225
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index e40edf1..879789c 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -959,7 +959,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements String token = editable.toString().substring(tokenStart, tokenEnd); final String trimmedToken = token.trim(); int commitCharIndex = trimmedToken.lastIndexOf(COMMIT_CHAR_COMMA); - if (commitCharIndex == trimmedToken.length() - 1) { + if (commitCharIndex != -1 && commitCharIndex == trimmedToken.length() - 1) { token = trimmedToken.substring(0, trimmedToken.length() - 1); } RecipientEntry entry = createTokenizedEntry(token); |