Add null check for CarrierConfig

CarrierConfig maybe null when config loader is not ready, so we need
to add null check here.

Bug: 124447166
Test: RunSettingsRoboTests
Change-Id: I3c104f1ca44bb0bcacad460c68084163c758746a
This commit is contained in:
jackqdyulei
2019-02-14 11:30:02 -08:00
parent 88d6b2f9ad
commit 26a5023d7f
4 changed files with 19 additions and 5 deletions

View File

@@ -111,4 +111,12 @@ public class AutoSelectPreferenceControllerTest {
mContext.getString(R.string.manual_mode_disallowed_summary,
mTelephonyManager.getSimOperatorName()));
}
@Test
public void init_carrierConfigNull_shouldNotCrash() {
when(mCarrierConfigManager.getConfigForSubId(SUB_ID)).thenReturn(null);
// Should not crash
mController.init(SUB_ID);
}
}