summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/phonenumbercache
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-02-20 15:13:35 -0800
committerEric Erfanian <erfanian@google.com>2018-02-22 21:09:26 +0000
commit078a8340a1e7077c25a78698804cc3ed3d90051f (patch)
tree478775062015260ef8ab1d468c0c9cbfb8502b72 /java/com/android/dialer/phonenumbercache
parent844dcad13ad494256dddfdc44f7ad90a5f93c530 (diff)
Fix an NPE when ContactInfoHelper tries to retrieve remote directories.
Bug: 73593111 Test: None PiperOrigin-RevId: 186370203 Change-Id: I7b328dc546c9ae828f70c0467d03243305591ea9
Diffstat (limited to 'java/com/android/dialer/phonenumbercache')
-rw-r--r--java/com/android/dialer/phonenumbercache/ContactInfoHelper.java7
1 files changed, 3 insertions, 4 deletions
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);