[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:
@@ -141,7 +141,8 @@ public class SelectableSubscriptions implements Callable<List<SubscriptionAnnota
|
|||||||
protected List<SubscriptionInfo> getSubInfoList(Context context,
|
protected List<SubscriptionInfo> getSubInfoList(Context context,
|
||||||
Function<SubscriptionManager, List<SubscriptionInfo>> convertor) {
|
Function<SubscriptionManager, List<SubscriptionInfo>> convertor) {
|
||||||
SubscriptionManager subManager = getSubscriptionManager(context);
|
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) {
|
protected SubscriptionManager getSubscriptionManager(Context context) {
|
||||||
|
|||||||
Reference in New Issue
Block a user