mirror of
https://codeberg.org/AntumLuanti/mod-cleaner.git
synced 2025-03-14 20:21:23 +00:00
Add nil check after reading world data file
Closes: https://github.com/AntumMT/mod-cleaner/issues/3
This commit is contained in:
parent
ecf5201220
commit
f35e2f1808
2 changed files with 7 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
v1.2.1
|
||||
----
|
||||
- use sounds mod for sounds
|
||||
- added nil check after reading world data file
|
||||
|
||||
|
||||
v1.2
|
||||
|
|
|
@ -28,8 +28,13 @@ local function get_world_data()
|
|||
local wdata = {}
|
||||
local buffer = io.open(world_file, "r")
|
||||
if buffer then
|
||||
wdata = core.parse_json(buffer:read("*a"))
|
||||
local err
|
||||
wdata, err = core.parse_json(buffer:read("*a"), nil, true)
|
||||
buffer:close()
|
||||
if wdata == nil then
|
||||
cleaner.log("warning", "reading world data file failed: " .. world_file)
|
||||
wdata = {}
|
||||
end
|
||||
end
|
||||
|
||||
local rem_types = {"entities", "nodes", "ores",}
|
||||
|
|
Loading…
Add table
Reference in a new issue