From a3b6a10fef905589937f2bbc172b93afb83b9fd9 Mon Sep 17 00:00:00 2001 From: YuanSheng Wang Date: Fri, 27 Sep 2019 04:15:56 +0800 Subject: [PATCH] bugfix: checked the `router.global_rules` first, it maybe nil. (#609) --- lua/apisix.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/apisix.lua b/lua/apisix.lua index 35f39039..33553b70 100644 --- a/lua/apisix.lua +++ b/lua/apisix.lua @@ -240,7 +240,8 @@ function _M.http_access_phase() core.ctx.set_vars_meta(api_ctx) -- load and run global rule - if router.global_rules.values and #router.global_rules.values > 0 then + if router.global_rules and router.global_rules.values + and #router.global_rules.values > 0 then local plugins = core.tablepool.fetch("plugins", 32, 0) for _, global_rule in ipairs(router.global_rules.values) do api_ctx.conf_type = "global_rule"