summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-06-28 14:43:00 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-28 16:26:09 -0700
commit80cafcbb7531b68e9acfadcb17c331a7c684b649 (patch)
tree3a729e27febbe0dbf50f70c4bd295ad23ced6550 /java
parent5b99e36d5139a4e6b141af45f4cbcd946d81675e (diff)
Make sure we have a host for the search fragment before loading data.
Bug: 110941275 Test: None PiperOrigin-RevId: 202546724 Change-Id: If8ca1f57ac61288efc13da07cfc88cee72e170c7
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/searchfragment/list/NewSearchFragment.java18
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;