Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error occurs if the opt.vars is not passed #146

Merged
merged 2 commits into from
Aug 16, 2024

Conversation

xuruidong
Copy link
Contributor

content_by_lua_block {
            local opts = {host = "127.0.0.1"}
            local radix = require("resty.radixtree")
            local rx = radix.new({
                {
                    paths = {"/aa*"},
                    hosts = "127.0.0.1:9080",
                    handler = function (ctx)
                        ngx.say("pass")
                    end
                }
            })
            ngx.say(rx:dispatch("/aa", opts))
        }

error log:

 "2024/04/08 13:12:50 [error] 9216#9216: *1 lua entry thread aborted: runtime error: ...ty-radixtree/lua-resty-radixtree/lib/resty/radixtree.lua:752: attempt to index field 'vars' (a nil value)" (req 0)
# stack traceback:
# coroutine 0:
# 	...ty-radixtree/lua-resty-radixtree/lib/resty/radixtree.lua: in function 'match_route_opts'
# 	...ty-radixtree/lua-resty-radixtree/lib/resty/radixtree.lua:812: in function '_match_from_routes'
# 	...ty-radixtree/lua-resty-radixtree/lib/resty/radixtree.lua:861: in function 'match_route'
# 	...ty-radixtree/lua-resty-radixtree/lib/resty/radixtree.lua:1000: in function 'dispatch'

Signed-off-by: xuruidong <xuruidong@gmail.com>
t/add.t Outdated Show resolved Hide resolved
@xuruidong xuruidong requested a review from membphis May 29, 2024 04:57
Copy link
Contributor

@membphis membphis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@membphis membphis merged commit 262d798 into api7:master Aug 16, 2024
2 checks passed
@membphis
Copy link
Contributor

@xuruidong many thx for your contribution

@xuruidong xuruidong deleted the opt_var branch August 16, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants