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
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 @@
                                     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.