From 17cb488fd85e452df86eae7da6a20fbd181caafa Mon Sep 17 00:00:00 2001 From: Xunzhuo Date: Sat, 28 Oct 2023 23:57:59 +0800 Subject: [PATCH] fix: panic when using nil xdsRouteAction (#2104) Signed-off-by: bitliu (cherry picked from commit 77445dec77f1dbf64e343f0dd2d7537b6c9b7eb3) Signed-off-by: Arko Dasgupta --- internal/xds/translator/ratelimit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/xds/translator/ratelimit.go b/internal/xds/translator/ratelimit.go index 36d5c4aa020..6a347904079 100644 --- a/internal/xds/translator/ratelimit.go +++ b/internal/xds/translator/ratelimit.go @@ -128,7 +128,7 @@ func (t *Translator) buildRateLimitFilter(irListener *ir.HTTPListener) *hcmv3.Ht // patchRouteWithRateLimit builds rate limit actions and appends to the route. func patchRouteWithRateLimit(xdsRouteAction *routev3.RouteAction, irRoute *ir.HTTPRoute) error { //nolint:unparam // Return early if no rate limit config exists. - if irRoute.RateLimit == nil || irRoute.RateLimit.Global == nil { + if irRoute.RateLimit == nil || irRoute.RateLimit.Global == nil || xdsRouteAction == nil { return nil }