Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 827f8ce9 authored by M. Kiesel's avatar M. Kiesel
Browse files

avoid NPE/fatal exception if wpa_supplicant fails

If wpa_supplicant dies unexpectedly (for example due to
broken wpa_supplicant.conf), WifiStateService tries to
stop DHCP. If no DhcpHandler has been created yet, this
causes an NPE which is not caught. This leads to a fatal
exception in ConnectivityThread, finally causing Zygote
to shutdown and reinit in a loop.
These additional null checks fix the problem.

Change-Id: Id7d9212225c2b5f8d1dadcb9049b03b6e28550ea
parent 3977575b
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -969,7 +969,9 @@ public class WifiStateTracker extends NetworkStateTracker {
                    resetConnections(true);
                }
                // When supplicant dies, kill the DHCP thread
                if (mDhcpTarget != null) {
                    mDhcpTarget.getLooper().quit();
                }

                mContext.removeStickyBroadcast(new Intent(WifiManager.NETWORK_STATE_CHANGED_ACTION));
                if (ActivityManagerNative.isSystemReady()) {
@@ -1441,8 +1443,10 @@ public class WifiStateTracker extends NetworkStateTracker {
        NetworkUtils.resetConnections(mInterfaceName);

        // Stop DHCP
        if (mDhcpTarget != null) {
            mDhcpTarget.setCancelCallback(true);
            mDhcpTarget.removeMessages(EVENT_DHCP_START);
        }

        if (!NetworkUtils.stopDhcp(mInterfaceName)) {
            Log.e(TAG, "Could not stop DHCP");