1
0
Fork 0

Fix crash in villagegen

This commit is contained in:
cora 2022-10-28 13:34:58 +02:00
parent 5d26595f4a
commit 6b8236e8f3
2 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@ function table.update_nil(t, ...)
end
function mcl_util.file_exists(name)
if type(name) ~= "string" then return end
local f = io.open(name)
if not f then
return false

View File

@ -32,8 +32,8 @@ local function ecb_place(blockpos, action, calls_remaining, param)
end
function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
if not mcl_util.file_exists(schematic) then
minetest.log("warning","[mcl_structures] schematic file "..schematic.." does not exist.")
if type(schematic) ~= "table" and not mcl_util.file_exists(schematic) then
minetest.log("warning","[mcl_structures] schematic file "..tostring(schematic).." does not exist.")
return end
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")()
if s and s.size then