Fix NPE in ConnectivityService

Could occur when requestRouteToHostAddress is called on a network
with no associated tracker.  Code later in the method handles
this case gracefully but code introduced in JB throws an exception.

Change-Id: I6c8a0e313ecbcca120aeb5dd0802a72114749aa1
This commit is contained in:
Ken Mixter
2013-11-07 22:08:24 -08:00
parent 4e3475964b
commit 0c6544bd73

View File

@@ -1432,9 +1432,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
return false; return false;
} }
NetworkStateTracker tracker = mNetTrackers[networkType]; NetworkStateTracker tracker = mNetTrackers[networkType];
DetailedState netState = tracker.getNetworkInfo().getDetailedState(); DetailedState netState = DetailedState.DISCONNECTED;
if (tracker != null) {
netState = tracker.getNetworkInfo().getDetailedState();
}
if (tracker == null || (netState != DetailedState.CONNECTED && if ((netState != DetailedState.CONNECTED &&
netState != DetailedState.CAPTIVE_PORTAL_CHECK) || netState != DetailedState.CAPTIVE_PORTAL_CHECK) ||
tracker.isTeardownRequested()) { tracker.isTeardownRequested()) {
if (VDBG) { if (VDBG) {