Check if the slot info is null to avoid exception

Bug: 198298029
Test: manual
Change-Id: Id5ad70e24ee2ddbb0e4910257e298c33709044a0
This commit is contained in:
Hui Wang
2021-08-31 10:49:59 -07:00
parent d6af8c5580
commit 3cf475553e

View File

@@ -3483,7 +3483,8 @@ public class TelephonyManager {
*/
private int getLogicalSlotIndex(int physicalSlotIndex) {
UiccSlotInfo[] slotInfos = getUiccSlotsInfo();
if (slotInfos != null && physicalSlotIndex >= 0 && physicalSlotIndex < slotInfos.length) {
if (slotInfos != null && physicalSlotIndex >= 0 && physicalSlotIndex < slotInfos.length
&& slotInfos[physicalSlotIndex] != null) {
return slotInfos[physicalSlotIndex].getLogicalSlotIdx();
}