Skip to content

Commit 8382bd8

Browse files
authored
xds: fix clusterImplLoadBalancer NPE when lrs is null (#8713)
1 parent dd0db6c commit 8382bd8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

xds/src/main/java/io/grpc/xds/ClusterImplLoadBalancer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,11 @@ public PickResult pickSubchannel(PickSubchannelArgs args) {
319319
}
320320
final ClusterLocalityStats stats =
321321
result.getSubchannel().getAttributes().get(ATTR_CLUSTER_LOCALITY_STATS);
322-
ClientStreamTracer.Factory tracerFactory = new CountingStreamTracerFactory(
323-
stats, inFlights, result.getStreamTracerFactory());
324-
return PickResult.withSubchannel(result.getSubchannel(), tracerFactory);
322+
if (stats != null) {
323+
ClientStreamTracer.Factory tracerFactory = new CountingStreamTracerFactory(
324+
stats, inFlights, result.getStreamTracerFactory());
325+
return PickResult.withSubchannel(result.getSubchannel(), tracerFactory);
326+
}
325327
}
326328
return result;
327329
}

0 commit comments

Comments
 (0)