check if node is registered before checking if walkable

This commit is contained in:
OgelGames 2019-12-30 18:49:22 +11:00
parent 06c076a885
commit bb15b744ff

@ -80,7 +80,8 @@ function tp.find_free_position_near(pos)
}
for _,d in pairs(tries) do
local p = vector.add(pos, d)
if not minetest.registered_nodes[minetest.get_node(p).name].walkable then
local def = minetest.registered_nodes[minetest.get_node(p).name]
if def and not def.walkable then
return p, true
end
end