From 946de8219595f14fb744d8ddbc18b192f7720c04 Mon Sep 17 00:00:00 2001 From: dianlujitao Date: Thu, 21 Mar 2024 20:05:49 +0800 Subject: [PATCH] MotoNrEnabler: fix null check of getSystemService after U QPR2 Change-Id: Iec4852986457495ca15c94d9f7e425c999f85a60 --- .../src/org/lineageos/motorola/nrenabler/NrEnablerService.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt b/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt index 4aea5a3..4644ba2 100644 --- a/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt +++ b/MotoNrEnabler/src/org/lineageos/motorola/nrenabler/NrEnablerService.kt @@ -13,7 +13,6 @@ import android.content.IntentFilter import android.os.Handler import android.os.IBinder import android.telephony.CarrierConfigManager -import android.telephony.SubscriptionInfo import android.telephony.SubscriptionManager import android.telephony.TelephonyManager import android.util.Log @@ -82,7 +81,8 @@ class NrEnablerService : Service() { } private fun validatePhoneId(phoneId: Int): Boolean { - val phoneCount = getSystemService(TelephonyManager::class.java).activeModemCount + val phoneCount = + getSystemService(TelephonyManager::class.java)?.activeModemCount ?: return false return phoneId in 0 until phoneCount } -- 2.20.1