From affb984c5616537d2e9d63a3f93a9df8c8d7ec62 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 14 Dec 2019 01:30:21 +0100 Subject: [PATCH] Fix mapgen crash if there's unknown nodes --- mods/MAPGEN/mcl_mapgen_core/init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mods/MAPGEN/mcl_mapgen_core/init.lua b/mods/MAPGEN/mcl_mapgen_core/init.lua index 3a4d972f91..4b65653dbb 100644 --- a/mods/MAPGEN/mcl_mapgen_core/init.lua +++ b/mods/MAPGEN/mcl_mapgen_core/init.lua @@ -1097,9 +1097,12 @@ local function generate_structures(minp, maxp, seed, biomemap) local ground_y = nil for y = struct_max, struct_min, -1 do local checknode = minetest.get_node_or_nil({x=x,y=y,z=z}) - if checknode and minetest.registered_nodes[checknode.name].walkable then - ground_y = y - break + if checknode then + local def = minetest.registered_nodes[checknode.name] + if def and def.walkable then + ground_y = y + break + end end end