Interpret empty NetworkObjectGroup as EmptyIpSpace
When converting a NetworkObjectGroup to an IpSpace, we should interpret an empty group as EmptyIpSpace. Previously, an empty group is converted to null, which can cause NPEs later.
@@ -35,6 +35,7 @@ import org.batfish.datamodel.AsPathAccessListLine;
import org.batfish.datamodel.CommunityList;
import org.batfish.datamodel.CommunityListLine;
import org.batfish.datamodel.Configuration;
+import org.batfish.datamodel.EmptyIpSpace;
import org.batfish.datamodel.HeaderSpace;
import org.batfish.datamodel.IkeGateway;
import org.batfish.datamodel.IkeKeyType;
@@ -568,7 +569,7 @@ class CiscoConversions {
}
static IpSpace toIpSpace(NetworkObjectGroup networkObjectGroup) {
- return AclIpSpace.union(networkObjectGroup.getLines());
+ return firstNonNull(AclIpSpace.union(networkObjectGroup.getLines()), EmptyIpSpace.INSTANCE);
}
/** Converts a {@link Tunnel} to an {@link IpsecPeerConfig} */
