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

Commit 96be0f51 authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by Automerger Merge Worker
Browse files

Don't crash or wtf if the interface doesn't exist. am: 1725a2cd am: 3a9c1baf

Change-Id: I104a77fc2ece1f94ee8500e902492e1483878f12
parents a4e8c809 3a9c1baf
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -1699,25 +1699,27 @@ public class IpClient extends StateMachine {
    class ClearingIpAddressesState extends State {
        @Override
        public void enter() {
            if (readyToProceed()) {
                deferMessage(obtainMessage(CMD_ADDRESSES_CLEARED));
            } else {
                // Clear all IPv4 and IPv6 before proceeding to RunningState.
                // Clean up any leftover state from an abnormal exit from
                // tethering or during an IpClient restart.
                stopAllIP();
            }

            // Ensure that interface parameters are fetched on the handler thread so they are
            // properly ordered with other events, such as restoring the interface MTU on teardown.
            mInterfaceParams = mDependencies.getInterfaceParams(mInterfaceName);
            if (mInterfaceParams == null) {
                logError("Failed to find InterfaceParams for " + mInterfaceName);
                doImmediateProvisioningFailure(IpManagerEvent.ERROR_INTERFACE_NOT_FOUND);
                transitionTo(mStoppedState);
                deferMessage(obtainMessage(CMD_STOP));
                return;
            }

            mLinkObserver.setInterfaceParams(mInterfaceParams);

            if (readyToProceed()) {
                deferMessage(obtainMessage(CMD_ADDRESSES_CLEARED));
            } else {
                // Clear all IPv4 and IPv6 before proceeding to RunningState.
                // Clean up any leftover state from an abnormal exit from
                // tethering or during an IpClient restart.
                stopAllIP();
            }

            mCallback.setNeighborDiscoveryOffload(true);
        }

@@ -1752,7 +1754,7 @@ public class IpClient extends StateMachine {
        }

        private boolean readyToProceed() {
            return (!mLinkProperties.hasIpv4Address() && !mLinkProperties.hasGlobalIpv6Address());
            return !mLinkProperties.hasIpv4Address() && !mLinkProperties.hasGlobalIpv6Address();
        }
    }