Add a null pointer check to the VcnConfig

Add a null pointer check before accessing the VcnConfig to
retrieve the restricted transport types.

Bug: 284381334
Test: atest CtsVcnTestCases, FrameworksVcnTestCases
Change-Id: I0cbab6e38f68d8c669db2ddb324b013baa93204a
This commit is contained in:
Yan Yan
2023-06-08 02:07:53 +00:00
parent 244f472b65
commit b5ec67911f

View File

@@ -1065,13 +1065,20 @@ public class VcnManagementService extends IVcnManagementService.Stub {
boolean isRestricted = false;
synchronized (mLock) {
final Vcn vcn = mVcns.get(subGrp);
final VcnConfig vcnConfig = mConfigs.get(subGrp);
if (vcn != null) {
if (vcnConfig == null) {
// TODO: b/284381334 Investigate for the root cause of this issue
// and handle it properly
logWtf("Vcn instance exists but VcnConfig does not for " + subGrp);
}
if (vcn.getStatus() == VCN_STATUS_CODE_ACTIVE) {
isVcnManagedNetwork = true;
}
final Set<Integer> restrictedTransports = mDeps.getRestrictedTransports(
subGrp, mLastSnapshot, mConfigs.get(subGrp));
subGrp, mLastSnapshot, vcnConfig);
for (int restrictedTransport : restrictedTransports) {
if (ncCopy.hasTransport(restrictedTransport)) {
if (restrictedTransport == TRANSPORT_CELLULAR