diff options
-rw-r--r-- | java/com/android/dialer/searchfragment/list/NewSearchFragment.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java index 65ce87340..809f91775 100644 --- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java +++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java @@ -121,11 +121,23 @@ public final class NewSearchFragment extends Fragment // the contacts in them). private final List<Directory> directories = new ArrayList<>(); private final Runnable loaderCp2ContactsRunnable = - () -> getLoaderManager().restartLoader(CONTACTS_LOADER_ID, null, this); + () -> { + if (getHost() != null) { + getLoaderManager().restartLoader(CONTACTS_LOADER_ID, null, this); + } + }; private final Runnable loadNearbyPlacesRunnable = - () -> getLoaderManager().restartLoader(NEARBY_PLACES_LOADER_ID, null, this); + () -> { + if (getHost() != null) { + getLoaderManager().restartLoader(NEARBY_PLACES_LOADER_ID, null, this); + } + }; private final Runnable loadDirectoryContactsRunnable = - () -> getLoaderManager().restartLoader(DIRECTORY_CONTACTS_LOADER_ID, null, this); + () -> { + if (getHost() != null) { + getLoaderManager().restartLoader(DIRECTORY_CONTACTS_LOADER_ID, null, this); + } + }; private final Runnable capabilitiesUpdatedRunnable = () -> adapter.notifyDataSetChanged(); private Runnable updatePositionRunnable; |