Skip to content
This repository was archived by the owner on Apr 21, 2021. It is now read-only.

Commit 271c78c

Browse files
author
AndroidDeveloperLB
committed
Fixed a very rare crashing bug.
1 parent c04f571 commit 271c78c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎ChipsLibrary/src/com/android/ex/chips/RecipientEditTextView.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,11 @@ private void shrink()
495495
final int end=getSelectionEnd();
496496
final int start=mTokenizer.findTokenStart(editable,end);
497497
final DrawableRecipientChip[] chips=getSpannable().getSpans(start,end,DrawableRecipientChip.class);
498-
if(chips==null||chips.length==0)
498+
if(chips==null||chips.length==0&&start>=0)
499499
{
500500
final Editable text=getText();
501+
// TODO check why this code can crash (index out of bounds). Currently fixed by checking that
502+
// start>=0
501503
int whatEnd=mTokenizer.findTokenEnd(text,start);
502504
// This token was already tokenized, so skip past the ending token.
503505
if(whatEnd<text.length()&&text.charAt(whatEnd)==',')

0 commit comments

Comments
 (0)