diff options
author | calderwoodra <calderwoodra@google.com> | 2017-09-12 13:01:56 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-09-13 14:16:40 -0700 |
commit | 7bea0364b6f8932f54cdb518de1014f408f0f3f3 (patch) | |
tree | 718835c63a669020ccc5546472111985f4410b4e /java | |
parent | 7f78e9a692d7d7ca1f1204421adce91545a880f8 (diff) |
Fixed crash in RemoteContactCusror.
Test: manual
PiperOrigin-RevId: 168427349
Change-Id: Ie58920b76266ebb298210b5faac8fcbda4dbcd15
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/searchfragment/remote/RemoteContactsCursor.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/java/com/android/dialer/searchfragment/remote/RemoteContactsCursor.java b/java/com/android/dialer/searchfragment/remote/RemoteContactsCursor.java index e6f3c2607..5d80a452c 100644 --- a/java/com/android/dialer/searchfragment/remote/RemoteContactsCursor.java +++ b/java/com/android/dialer/searchfragment/remote/RemoteContactsCursor.java @@ -118,12 +118,19 @@ public final class RemoteContactsCursor extends MergeCursor implements SearchCur int position = getPosition(); // proceed backwards until we reach the header row, which contains the directory ID. while (moveToPrevious()) { - int id = getInt(getColumnIndex(COLUMN_DIRECTORY_ID)); - if (id != -1) { - // return the cursor to it's original position/state - moveToPosition(position); - return id; + int columnIndex = getColumnIndex(COLUMN_DIRECTORY_ID); + if (columnIndex == -1) { + continue; } + + int id = getInt(columnIndex); + if (id == -1) { + continue; + } + + // return the cursor to it's original position/state + moveToPosition(position); + return id; } throw Assert.createIllegalStateFailException("No directory id for contact at: " + position); } |