2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 05:07:40 +00:00

Fix telephony plugin while no SIM card inserted

On my Nokia 8, no SIM card means that there is no subscription
info, which will lead subscription info list a null pointer.
This commit is contained in:
Weixuan XIAO 2020-06-09 10:41:34 +02:00 committed by Weixuan Xiao
parent f1d8ae2f7d
commit 0caa30e1d7

View File

@ -96,6 +96,11 @@ public class TelephonyHelper {
return Collections.emptyList();
}
List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList();
if (subscriptionInfos == null) {
// This happens when there is no SIM card inserted
Log.w(LOGGING_TAG, "Could not get SubscriptionInfos");
return Collections.emptyList();
}
List<String> phoneNumbers = new ArrayList<>(subscriptionInfos.size());
for (SubscriptionInfo info : subscriptionInfos) {
phoneNumbers.add(info.getNumber());