From ba6afe1adbb6afed25bd78e88b541326d969dba2 Mon Sep 17 00:00:00 2001 From: David Su Date: Tue, 14 May 2019 20:10:25 -0700 Subject: Fix NPE from null cellular subscription displayName Check for null before calling toString() on possibly null displayName. Bug: 132391746 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: Iba33501c90ca552c08aaee52d36f1610bd6a6180 --- service/java/com/android/server/wifi/CarrierNetworkConfig.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/CarrierNetworkConfig.java b/service/java/com/android/server/wifi/CarrierNetworkConfig.java index 6e754231f..20aac5bc1 100644 --- a/service/java/com/android/server/wifi/CarrierNetworkConfig.java +++ b/service/java/com/android/server/wifi/CarrierNetworkConfig.java @@ -249,9 +249,11 @@ public class CarrierNetworkConfig { // Process the carrier config for each active subscription. for (SubscriptionInfo subInfo : subInfoList) { - processNetworkConfig( - carrierConfigManager.getConfigForSubId(subInfo.getSubscriptionId()), - subInfo.getDisplayName().toString()); + CharSequence displayNameCs = subInfo.getDisplayName(); + String displayNameStr = displayNameCs == null ? "" : displayNameCs.toString(); + PersistableBundle bundle = carrierConfigManager.getConfigForSubId( + subInfo.getSubscriptionId()); + processNetworkConfig(bundle, displayNameStr); } } -- cgit v1.2.3