[NetworkPolicy]: Fixes the crash issues caused by null pointer.
When handleRegisterNetworkAgent in ConnectivityService, the networkinfo of NetworkAgentInfo will be set to null. So we need to handle the null pointer of state.networkInfo. Change-Id: I2a278f1f1b2455057fd2ed323ff4df340c3cbca9 Signed-off-by: zhangshuxiao <zhangshuxiao@xiaomi.com>
This commit is contained in:
committed by
Shuxiao Zhang
parent
5b63231a31
commit
bad369d63e
@@ -1206,7 +1206,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
|
||||
final ArrayList<Pair<String, NetworkIdentity>> connIdents = new ArrayList<>(states.length);
|
||||
final ArraySet<String> connIfaces = new ArraySet<String>(states.length);
|
||||
for (NetworkState state : states) {
|
||||
if (state.networkInfo.isConnected()) {
|
||||
if (state.networkInfo != null && state.networkInfo.isConnected()) {
|
||||
final NetworkIdentity ident = NetworkIdentity.buildNetworkIdentity(mContext, state);
|
||||
|
||||
final String baseIface = state.linkProperties.getInterfaceName();
|
||||
|
||||
Reference in New Issue
Block a user