Fix crash in villagegen
This commit is contained in:
parent
5d26595f4a
commit
6b8236e8f3
|
@ -23,6 +23,7 @@ function table.update_nil(t, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_util.file_exists(name)
|
function mcl_util.file_exists(name)
|
||||||
|
if type(name) ~= "string" then return end
|
||||||
local f = io.open(name)
|
local f = io.open(name)
|
||||||
if not f then
|
if not f then
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -32,8 +32,8 @@ local function ecb_place(blockpos, action, calls_remaining, param)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
|
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
|
if type(schematic) ~= "table" and not mcl_util.file_exists(schematic) then
|
||||||
minetest.log("warning","[mcl_structures] schematic file "..schematic.." does not exist.")
|
minetest.log("warning","[mcl_structures] schematic file "..tostring(schematic).." does not exist.")
|
||||||
return end
|
return end
|
||||||
local s = loadstring(minetest.serialize_schematic(schematic, "lua", {lua_use_comments = false, lua_num_indent_spaces = 0}) .. " return schematic")()
|
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
|
if s and s.size then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user