1
0
mirror of https://github.com/minetest/minetest.git synced 2024-09-25 14:00:30 +02:00

Fix crash when teleporting near unknown node

This commit is contained in:
BlockMen 2014-04-11 21:38:16 +02:00
parent 6090e95cdc
commit fefec8cdc4

View File

@ -261,11 +261,14 @@ minetest.register_chatcommand("teleport", {
}
for _, d in ipairs(tries) do
local p = {x = pos.x+d.x, y = pos.y+d.y, z = pos.z+d.z}
local n = minetest.get_node(p)
if not minetest.registered_nodes[n.name].walkable then
local n = minetest.get_node_or_nil(p)
if n and n.name then
local def = minetest.registered_nodes[n.name]
if def and not def.walkable then
return p, true
end
end
end
return pos, false
end