Skip to content

Commit ff0c2b6

Browse files
committed
reading empty files should return an empty table, not nil
1 parent 555f1b4 commit ff0c2b6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

library/lua/json.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local _ENV = mkmodule('json')
2-
local internal = require 'json.internal'
2+
3+
local internal = require('json.internal')
34
local fs = dfhack.filesystem
45

56
encode_defaults = {
@@ -39,7 +40,7 @@ function decode_file(path, ...)
3940
end
4041
local contents = f:read('*all')
4142
f:close()
42-
return decode(contents, ...)
43+
return decode(contents, ...) or {}
4344
end
4445

4546
local _file = defclass()

0 commit comments

Comments
 (0)