From 47da96721f12edb84a224cb43ea78c7325b90b4d Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 28 May 2020 09:58:52 -0700 Subject: Add null check for getCurrentWifiConfiguration getCurrentWifiConfiguration can return null. So we need to check for returning null before calling any config functions. Bug: 157283586 Test: atest com.android.server.wifi Change-Id: Ia7a1b955ac94e79230ee96da55e13b24b6187e49 Merged-In: I763842889e778ceddb3776348ad9e90e27a44351 --- service/java/com/android/server/wifi/ClientModeImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index e36d379c4..0f84b3dd9 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -4146,7 +4146,13 @@ public class ClientModeImpl extends StateMachine { // We switched from DHCP to static or from static to DHCP, or the // static IP address has changed. log("Reconfiguring IP on connection"); - transitionTo(mObtainingIpState); + WifiConfiguration currentConfig = getCurrentWifiConfiguration(); + if (currentConfig != null) { + transitionTo(mObtainingIpState); + } else { + Log.w(TAG, "CMD_SAVE_NETWORK Ip change - but no current " + + "Wi-Fi config"); + } } } } else if (mWifiInfo.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID -- cgit v1.2.3