From 282b67b1c00910fccd4a145fa401d4cc47df240f Mon Sep 17 00:00:00 2001 From: tom hsu Date: Thu, 1 Jul 2021 22:32:26 +0800 Subject: [PATCH] [Settings] Prevent NPE from getting MobileIconGroup instance. Bug: 187812523 Test: Maunal test. Change-Id: Ief06c683c1c8a99d4ce2765cd802be221e55820e --- .../settings/network/SubscriptionsPreferenceController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java index e88cded175e..7c0fc29736a 100644 --- a/src/com/android/settings/network/SubscriptionsPreferenceController.java +++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java @@ -603,7 +603,11 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl public String getNetworkType(Context context, Config config, TelephonyDisplayInfo telephonyDisplayInfo, int subId) { 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 ? SubscriptionManager.getResourcesForSubId(context, subId).getString(resId) : "";