Skip to content

Commit

Permalink
Add assert() around loadfile() invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfoerster authored and flyx committed Mar 17, 2024
1 parent a78ca40 commit 7755e64
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ if i < #arg then
tex.error("zu viele Argumente. Erstes überflüssiges Argument: '" .. tostring(arg[i+1]) .. "'")
end

return loadfile("values.lua", "t")(arg[i])
return assert(loadfile("values.lua", "t"))(arg[i])
4 changes: 2 additions & 2 deletions src/tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ elseif arg[curarg] ~= nil then
end

local d = require("schemadef")
local schema = loadfile("schema.lua", "t")(true)
local schema = assert(loadfile("schema.lua", "t"))(true)

if gendoc then
if standalone then
Expand Down Expand Up @@ -94,7 +94,7 @@ end
if validate then
local res = 0
local prev_pcount = 0
local values = loadfile("values.lua")
local values = assert(loadfile("values.lua", "t"))
for i = curarg + 1,#arg do
values(arg[i])
end
Expand Down
2 changes: 1 addition & 1 deletion src/values.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local d = require("schemadef")
local schema = loadfile("schema.lua", "t")(false)
local schema = assert(loadfile("schema.lua", "t"))(false)
local skt = require("skt")

local input = ...
Expand Down

0 comments on commit 7755e64

Please sign in to comment.