Don't choke on failed node name parsing

This commit is contained in:
2024-08-02 16:49:31 -06:00
parent 71d2e537dd
commit 4a810e9964
2 changed files with 13 additions and 1 deletions

View File

@ -11,7 +11,11 @@ end
local function setup(db)
db:create_function("parse_node_name", 1, function(ctx, table_name)
local obj = csexp.parse(table_name)
local ok, obj = pcall(csexp.parse, table_name)
if not ok then
ctx:result_null()
return
end
if type(obj) ~= "table" or obj[1] ~= "node" then
ctx:result_null()
return