From a461ef920804ca3c787c2282d9abfb3cbfd72f9d Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sat, 13 Aug 2022 18:04:36 -0400 Subject: [PATCH] Handle "ghost" SIM slots gracefully On devices like the Japanese versions of Sony Xperia 5 II, the telephony HAL can end up reporting a "ghost" SIM slot that does not actually exist and (thus) has no IMEI assigned to it. In this case, our code would crash since we assumed every SIM slot reported to the telephony framework should be valid. The fix is simple -- abort when we realize that the SIM slot has no IMEI. --- .../main/java/im/angry/openeuicc/core/EuiccChannelManager.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt b/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt index b570f3b..c710c9d 100644 --- a/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt +++ b/app/src/main/java/im/angry/openeuicc/core/EuiccChannelManager.kt @@ -66,7 +66,7 @@ class EuiccChannelManager(private val context: Context) { uiccInfo.slotIndex, uiccInfo.cardId, "SIM ${uiccInfo.slotIndex}", - tm.getImei(uiccInfo.slotIndex), + tm.getImei(uiccInfo.slotIndex) ?: return null, uiccInfo.isRemovable )