summaryrefslogtreecommitdiffstats
path: root/chips
diff options
context:
space:
mode:
authorPaul Westbrook <pwestbro@google.com>2013-04-22 12:27:35 -0700
committerPaul Westbrook <pwestbro@google.com>2013-04-22 12:27:35 -0700
commitd259fd2d897c741fa5ca1067a4596beeb2e0a938 (patch)
treeecc9d0769e9d71c82d2943ff078ba7c061940106 /chips
parentf823cf9a25b9010dbe3cb79ee188d6affec0e596 (diff)
downloadandroid_frameworks_ex-d259fd2d897c741fa5ca1067a4596beeb2e0a938.tar.gz
android_frameworks_ex-d259fd2d897c741fa5ca1067a4596beeb2e0a938.tar.bz2
android_frameworks_ex-d259fd2d897c741fa5ca1067a4596beeb2e0a938.zip
Prevent IOOB exception
The chips code was expecting a space after an email address when replacing it with a chip. If there is no extra space (which can happen when receiving an intent) don't walk off the end of the string Bug: 8635860 Change-Id: I1d40a08f1cbf11740172b0ea62ab11d656fb23f9
Diffstat (limited to 'chips')
-rw-r--r--chips/src/com/android/ex/chips/RecipientEditTextView.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java
index 8b6367f..62a60b0 100644
--- a/chips/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java
@@ -2566,7 +2566,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements
if (start != -1) {
// Replacing the entirety of what the chip represented,
// including the extra space dividing it from other chips.
- final int end = text.getSpanEnd(chip) + 1;
+ final int end =
+ Math.min(text.getSpanEnd(chip) + 1, text.length());
text.removeSpan(chip);
// Make sure we always have just 1 space at the end to
// separate this chip from the next chip.