diff --git a/xds/src/main/java/io/grpc/xds/ClientXdsClient.java b/xds/src/main/java/io/grpc/xds/ClientXdsClient.java index 80e70d6d1c..f4dccc8a10 100644 --- a/xds/src/main/java/io/grpc/xds/ClientXdsClient.java +++ b/xds/src/main/java/io/grpc/xds/ClientXdsClient.java @@ -175,8 +175,11 @@ final class ClientXdsClient extends XdsClient implements XdsResponseHandler, Res logger.log(XdsLogLevel.WARNING, "Ignore an unknown type of DiscoveryResponse"); return; } - Set toParseResourceNames = (resourceType == LDS || resourceType == RDS ) ? null : - resourceSubscribers.get(xdsResourceType).keySet(); + Set toParseResourceNames = null; + if (!(resourceType == LDS || resourceType == RDS) + && resourceSubscribers.containsKey(xdsResourceType)) { + toParseResourceNames = resourceSubscribers.get(xdsResourceType).keySet(); + } XdsResourceType.Args args = new XdsResourceType.Args(serverInfo, versionInfo, nonce, bootstrapInfo, filterRegistry, loadBalancerRegistry, tlsContextManager, toParseResourceNames);