Skip to content

Commit bf3ebf6

Browse files
committed
Added argument type-checking to json.decode()
1 parent 89b0e90 commit bf3ebf6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

json.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ end
370370

371371

372372
function json.decode(str)
373+
if type(str) ~= "string" then
374+
error("expected argument of type string, got " .. type(str))
375+
end
373376
return ( parse(str, next_char(str, 1, space_chars, true)) )
374377
end
375378

0 commit comments

Comments
 (0)