2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 13:17:43 +00:00

Add null check in TelephonyHelper.getAllPhoneNumbers().

This commit is contained in:
Isira Seneviratne 2020-08-13 19:33:33 +05:30 committed by Nicolas Fella
parent 6ae658e6fd
commit ca69a1f4fc

View File

@ -46,6 +46,11 @@ public class TelephonyHelper {
return Collections.emptyList(); return Collections.emptyList();
} }
List<SubscriptionInfo> subscriptionInfos = subscriptionManager.getActiveSubscriptionInfoList(); 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<Integer> subscriptionIDs = new ArrayList<>(subscriptionInfos.size()); List<Integer> subscriptionIDs = new ArrayList<>(subscriptionInfos.size());
for (SubscriptionInfo info : subscriptionInfos) { for (SubscriptionInfo info : subscriptionInfos) {
subscriptionIDs.add(info.getSubscriptionId()); subscriptionIDs.add(info.getSubscriptionId());