Skip to content

Commit

Permalink
xds: fix clusterImplLoadBalancer NPE when lrs is null (#8713)
Browse files Browse the repository at this point in the history
  • Loading branch information
YifeiZhuang committed Nov 18, 2021
1 parent dd0db6c commit 8382bd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions xds/src/main/java/io/grpc/xds/ClusterImplLoadBalancer.java
Expand Up @@ -319,9 +319,11 @@ public PickResult pickSubchannel(PickSubchannelArgs args) {
}
final ClusterLocalityStats stats =
result.getSubchannel().getAttributes().get(ATTR_CLUSTER_LOCALITY_STATS);
ClientStreamTracer.Factory tracerFactory = new CountingStreamTracerFactory(
stats, inFlights, result.getStreamTracerFactory());
return PickResult.withSubchannel(result.getSubchannel(), tracerFactory);
if (stats != null) {
ClientStreamTracer.Factory tracerFactory = new CountingStreamTracerFactory(
stats, inFlights, result.getStreamTracerFactory());
return PickResult.withSubchannel(result.getSubchannel(), tracerFactory);
}
}
return result;
}
Expand Down

0 comments on commit 8382bd8

Please sign in to comment.