Merge "[Settings] Prevent NPE from getting MobileIconGroup instance." into sc-dev

This commit is contained in:
Tom Hsu
2021-07-02 09:10:51 +00:00
committed by Android (Google) Code Review

View File

@@ -603,7 +603,11 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
public String getNetworkType(Context context, Config config, public String getNetworkType(Context context, Config config,
TelephonyDisplayInfo telephonyDisplayInfo, int subId) { TelephonyDisplayInfo telephonyDisplayInfo, int subId) {
String iconKey = getIconKey(telephonyDisplayInfo); String iconKey = getIconKey(telephonyDisplayInfo);
int resId = mapIconSets(config).get(iconKey).dataContentDescription; MobileIconGroup iconGroup = mapIconSets(config).get(iconKey);
int resId = 0;
if (iconGroup != null) {
resId = iconGroup.dataContentDescription;
}
return resId != 0 return resId != 0
? SubscriptionManager.getResourcesForSubId(context, subId).getString(resId) ? SubscriptionManager.getResourcesForSubId(context, subId).getString(resId)
: ""; : "";