[Settings] Add null pointer protection for Subscription API

Avoid from Settings app crash when having null pointer returned from SubscriptionManager API.

Bug: 226042289
Change-Id: I69ad2c7244f86220a61fb8fa9de2b556dbcec5a0
Test: local
This commit is contained in:
Bonian Chen
2022-03-29 09:04:27 +00:00
parent 670016a2ee
commit 84012c3054

View File

@@ -141,7 +141,8 @@ public class SelectableSubscriptions implements Callable<List<SubscriptionAnnota
protected List<SubscriptionInfo> getSubInfoList(Context context,
Function<SubscriptionManager, List<SubscriptionInfo>> convertor) {
SubscriptionManager subManager = getSubscriptionManager(context);
return (subManager == null) ? Collections.emptyList() : convertor.apply(subManager);
List<SubscriptionInfo> result = (subManager == null) ? null : convertor.apply(subManager);
return (result == null) ? Collections.emptyList() : result;
}
protected SubscriptionManager getSubscriptionManager(Context context) {