[Settings] Prevent NPE from getting MobileIconGroup instance.

Bug: 187812523
Test: Maunal test.
Change-Id: Ief06c683c1c8a99d4ce2765cd802be221e55820e
This commit is contained in:
tom hsu
2021-07-01 22:32:26 +08:00
parent d60eae5539
commit 282b67b1c0

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)
: ""; : "";