Skip to content

Commit f0409ac

Browse files
committed
Validating some arguments.
1 parent ee94ef3 commit f0409ac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dumbParser.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,6 +2103,9 @@ end
21032103
-- action = callback( astNode, container, key )
21042104
-- action = "stop"|"ignorechildren"|nil -- Returning nil (or nothing) means continue traversal.
21052105
function traverseTree(node, cb, container, k)
2106+
if type(node) ~= "table" then error(F("bad argument #1 to 'traverseTree' (table expected, got %s)", type(node)), 2) end
2107+
if type(cb) ~= "function" then error(F("bad argument #2 to 'traverseTree' (function expected, got %s)", type(cb )), 2) end
2108+
21062109
local action = cb(node, container, k)
21072110
if action == "stop" then return true end
21082111
if action == "ignorechildren" then return false end

0 commit comments

Comments
 (0)