From 078a8340a1e7077c25a78698804cc3ed3d90051f Mon Sep 17 00:00:00 2001 From: linyuh Date: Tue, 20 Feb 2018 15:13:35 -0800 Subject: Fix an NPE when ContactInfoHelper tries to retrieve remote directories. Bug: 73593111 Test: None PiperOrigin-RevId: 186370203 Change-Id: I7b328dc546c9ae828f70c0467d03243305591ea9 --- java/com/android/dialer/phonenumbercache/ContactInfoHelper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/phonenumbercache') diff --git a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java index 04226552d..e99533a40 100644 --- a/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java +++ b/java/com/android/dialer/phonenumbercache/ContactInfoHelper.java @@ -15,7 +15,6 @@ package com.android.dialer.phonenumbercache; import android.annotation.TargetApi; -import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; @@ -299,12 +298,12 @@ public class ContactInfoHelper { VERSION.SDK_INT >= VERSION_CODES.N ? Directory.ENTERPRISE_CONTENT_URI : Directory.CONTENT_URI; - ContentResolver cr = context.getContentResolver(); - Cursor cursor = cr.query(uri, new String[] {Directory._ID}, null, null, null); - int idIndex = cursor.getColumnIndex(Directory._ID); + Cursor cursor = + context.getContentResolver().query(uri, new String[] {Directory._ID}, null, null, null); if (cursor == null) { return remoteDirectories; } + int idIndex = cursor.getColumnIndex(Directory._ID); try { while (cursor.moveToNext()) { long directoryId = cursor.getLong(idIndex); -- cgit v1.2.3