Fix null pointer in SubscriptionUtil

Sometimes we get null sub info which causes a crash. This just
makes it so that if we see that we treat it as inactive since
there isn't really a world where an active null sub info makes
sense.

Test: atest SubscriptionUtilTest
Bug: 131603073
Change-Id: Id5ecbecf011e19ff02d9465e0571b1d17c83de9a
This commit is contained in:
Salvador Martinez
2019-04-30 09:56:25 -07:00
parent 8b285f2355
commit b5d471c19b
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;
}