diff options
author | Roshan Pius <rpius@google.com> | 2020-05-28 09:58:52 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2020-05-28 19:26:22 +0000 |
commit | 47da96721f12edb84a224cb43ea78c7325b90b4d (patch) | |
tree | 5c141c77f46845268094497dae473c022063c86f | |
parent | d8385620730a483b98a8db3b86b1a150450cf105 (diff) |
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
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 8 |
1 files changed, 7 insertions, 1 deletions
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 |