Merge "Fix null pointer in SubscriptionUtil" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-30 23:43:42 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 1 deletions

View File

@@ -59,7 +59,11 @@ public class SubscriptionUtil {
return subscriptions;
}
private static boolean isInactiveInsertedPSim(UiccSlotInfo slotInfo) {
@VisibleForTesting
static boolean isInactiveInsertedPSim(UiccSlotInfo slotInfo) {
if (slotInfo == null) {
return false;
}
return !slotInfo.getIsEuicc() && !slotInfo.getIsActive() &&
slotInfo.getCardStateInfo() == CARD_STATE_INFO_PRESENT;
}

View File

@@ -187,4 +187,9 @@ public class SubscriptionUtilTest {
assertThat(subs).isNotNull();
assertThat(subs).hasSize(2);
}
@Test
public void isInactiveInsertedPSim_nullSubInfo_doesNotCrash() {
assertThat(SubscriptionUtil.isInactiveInsertedPSim(null)).isFalse();
}
}