From b3e1537ec563cf343f46c643a84d67078c44dabf Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Mon, 14 Dec 2015 15:32:19 -0800 Subject: Fix NPE in startLoading Check for null activity. Bug:26183802 Change-Id: Ic1bdae3611513f43b5556145ea72aaf22d602a74 --- src/com/android/dialer/list/SearchFragment.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/com/android/dialer/list/SearchFragment.java b/src/com/android/dialer/list/SearchFragment.java index 9b0f53621..980858f75 100644 --- a/src/com/android/dialer/list/SearchFragment.java +++ b/src/com/android/dialer/list/SearchFragment.java @@ -15,8 +15,6 @@ */ package com.android.dialer.list; -import static android.Manifest.permission.READ_CONTACTS; - import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; @@ -358,7 +356,11 @@ public class SearchFragment extends PhoneNumberPickerFragment { @Override protected void startLoading() { - if (PermissionsUtil.hasPermission(getActivity(), READ_CONTACTS)) { + if (getActivity() == null) { + return; + } + + if (PermissionsUtil.hasContactsPermissions(getActivity())) { super.startLoading(); } else if (TextUtils.isEmpty(getQueryString())) { // Clear out any existing call shortcuts. -- cgit v1.2.3