Merge "Add null pointer check for mConfig in onSessionLost" am: 9fe8fcdb37 am: 2527e8e270 am: 7b894e329f

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675749

Change-Id: I22101e585fc93c1fdb77bb7e3774255856ebf6f1
This commit is contained in:
Benedict Wong
2021-04-22 20:04:50 +00:00
committed by Automerger Merge Worker

View File

@@ -2698,19 +2698,21 @@ public class Vpn {
// prevent the NetworkManagementEventObserver from killing this VPN based on the
// interface going down (which we expect).
mInterface = null;
mConfig.interfaze = null;
if (mConfig != null) {
mConfig.interfaze = null;
// Set as unroutable to prevent traffic leaking while the interface is down.
if (mConfig != null && mConfig.routes != null) {
final List<RouteInfo> oldRoutes = new ArrayList<>(mConfig.routes);
// Set as unroutable to prevent traffic leaking while the interface is down.
if (mConfig.routes != null) {
final List<RouteInfo> oldRoutes = new ArrayList<>(mConfig.routes);
mConfig.routes.clear();
for (final RouteInfo route : oldRoutes) {
mConfig.routes.add(new RouteInfo(route.getDestination(), null /*gateway*/,
null /*iface*/, RTN_UNREACHABLE));
}
if (mNetworkAgent != null) {
mNetworkAgent.sendLinkProperties(makeLinkProperties());
mConfig.routes.clear();
for (final RouteInfo route : oldRoutes) {
mConfig.routes.add(new RouteInfo(route.getDestination(),
null /*gateway*/, null /*iface*/, RTN_UNREACHABLE));
}
if (mNetworkAgent != null) {
mNetworkAgent.sendLinkProperties(makeLinkProperties());
}
}
}
}