To avoid the NullPointerException of UiccSlotInfo

Bug: 307599094
Test: Build pass
Change-Id: Ia3b8d29b37f2c9616856e9448c9f346b81229534
This commit is contained in:
SongFerngWang
2023-10-31 19:51:05 +08:00
parent b271e84e42
commit 0ba519f1b4
3 changed files with 16 additions and 8 deletions

View File

@@ -171,8 +171,11 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
}
int activePorts = 0;
for (UiccSlotInfo slotInfo : slotsInfo) {
if (slotInfo == null) {
continue;
}
for (UiccPortInfo portInfo : slotInfo.getPorts()) {
if (slotInfo != null && portInfo.isActive()) {
if (portInfo.isActive()) {
activePorts++;
}
}
@@ -189,8 +192,11 @@ public class EnableMultiSimSidecar extends AsyncTaskSidecar<Void, Boolean> {
}
Set<Integer> activeRemovableLogicalSlotIds = new ArraySet<>();
for (UiccSlotInfo info : infos) {
for (UiccPortInfo portInfo :info.getPorts()) {
if (info != null && portInfo.isActive() && info.isRemovable()) {
if (info == null) {
continue;
}
for (UiccPortInfo portInfo : info.getPorts()) {
if (portInfo.isActive() && info.isRemovable()) {
activeRemovableLogicalSlotIds.add(portInfo.getLogicalSlotIndex());
}
}