From dccc7d9438d8155d405d2e956d3e3b56135cb888 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Wed, 16 Aug 2017 23:15:39 -0700 Subject: Fix a crash in new search ui. Bug: 64691685 Test: existing PiperOrigin-RevId: 165543678 Change-Id: Ibeecc8f46310ad83cf7ccd86694b013bb222f184 --- java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/searchfragment/cp2') diff --git a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java index d5fcfba4f..6fd053cae 100644 --- a/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java +++ b/java/com/android/dialer/searchfragment/cp2/ContactFilterCursor.java @@ -125,8 +125,9 @@ final class ContactFilterCursor implements Cursor { continue; case Qualification.NEW_NUMBER_IS_MORE_QUALIFIED: // If number wasn't filtered out before, remove it and add it's more qualified version. - if (queryFilteredPositions.contains(previousMostQualifiedPosition)) { - queryFilteredPositions.remove(previousMostQualifiedPosition); + int index = queryFilteredPositions.indexOf(previousMostQualifiedPosition); + if (index != -1) { + queryFilteredPositions.remove(index); queryFilteredPositions.add(position); } previousMostQualifiedNumber = currentNumber; -- cgit v1.2.3