diff --git a/kong/router/compat.lua b/kong/router/compat.lua index 48ae00524086..dc0b5cdd08e9 100644 --- a/kong/router/compat.lua +++ b/kong/router/compat.lua @@ -537,9 +537,10 @@ end local function split_routes_and_services_by_path(routes_and_services) - local routes_and_services_split = tb_new(#routes_and_services, 0) + local count = #routes_and_services + local routes_and_services_split = tb_new(count, 0) - for i = 1, #routes_and_services do + for i = 1, count do split_route_by_path_into(routes_and_services[i], routes_and_services_split) end