From 05a1a8479839a7feb3e765c0ce5223b7a20826ce Mon Sep 17 00:00:00 2001 From: jli119X Date: Thu, 18 Oct 2012 12:55:47 +0800 Subject: Fix a Dead Loop issue in RecipientEditTextView The old code logic will cause dead loop when pasting phone number to recipient. Change-Id: I01183680289919105dadc28ffd40c8e60dfd6b7e Author: Jianping Li Signed-off-by: Jianping Li Signed-off-by: Shuo Gao Signed-off-by: Bruce Beare Signed-off-by: Jack Ren Author-tracking-BZ: 58793 --- chips/src/com/android/ex/chips/RecipientEditTextView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index 011b1e9..989365d 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -2264,12 +2264,12 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements int originalTokenStart = mTokenizer.findTokenStart(text, getSelectionEnd()); String lastAddress = text.substring(originalTokenStart); int tokenStart = originalTokenStart; - int prevTokenStart = tokenStart; + int prevTokenStart = 0; RecipientChip findChip = null; ArrayList created = new ArrayList(); if (tokenStart != 0) { // There are things before this! - while (tokenStart != 0 && findChip == null) { + while (tokenStart != 0 && findChip == null && tokenStart != prevTokenStart) { prevTokenStart = tokenStart; tokenStart = mTokenizer.findTokenStart(text, tokenStart); findChip = findChip(tokenStart); -- cgit v1.2.3