diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 58285039a..0972e5019 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -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 diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 719beebd8..6a7fc2c39 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -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