Guard against a NPE when disconnecting suggestion service.

Change-Id: Ib10502b9467365f6e348737655806ef2369a747b
Fixes: 68885411
Test: robotests
This commit is contained in:
Fan Zhang
2017-11-06 10:30:05 -08:00
parent b0f65ac832
commit f6073fb978
2 changed files with 14 additions and 1 deletions

View File

@@ -97,4 +97,14 @@ public class SuggestionControllerMixinTest {
verify(mHost).getLoaderManager();
}
@Test
public void onServiceDisconnected_hostNotAttached_shouldDoNothing() {
when(mHost.getLoaderManager()).thenReturn(null);
mMixin = new SuggestionControllerMixin(mContext, mHost, mLifecycle);
mMixin.onServiceDisconnected();
verify(mHost).getLoaderManager();
}
}