Merge "Fix Kotlin safety build error" into main am: aaac2b7a94

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Contacts/+/2857005

Change-Id: I8c6dccaa9452c0e774131ef9561cd2d2e7ee06ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/contacts/sdn/SdnRepository.kt b/src/com/android/contacts/sdn/SdnRepository.kt
index 082adeb..0759127 100644
--- a/src/com/android/contacts/sdn/SdnRepository.kt
+++ b/src/com/android/contacts/sdn/SdnRepository.kt
@@ -63,7 +63,7 @@
   @SuppressLint("MissingPermission")
   fun getSimCardInformation(): List<SimCard> {
     val subscriptionManager = context.getSystemService(SubscriptionManager::class.java)
-    return subscriptionManager.activeSubscriptionInfoList?.filterNotNull()?.mapNotNull {
+    return subscriptionManager?.activeSubscriptionInfoList?.filterNotNull()?.mapNotNull {
       if (it.subscriptionId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
         null
       } else {
@@ -77,7 +77,7 @@
   private fun fetchSdnFromCarrierConfig(simCard: SimCard): List<Sdn> {
     val carrierConfigManager = context.getSystemService(CarrierConfigManager::class.java)
     val carrierConfig =
-      carrierConfigManager.getConfigForSubId(simCard.subscriptionId) ?: return emptyList()
+      carrierConfigManager?.getConfigForSubId(simCard.subscriptionId) ?: return emptyList()
     val nameList: List<String> =
       carrierConfig
         .getStringArray(CarrierConfigManager.KEY_CARRIER_SERVICE_NAME_STRING_ARRAY)