Fix crash when teleporting near unknown node
parent
6090e95cdc
commit
fefec8cdc4
|
@ -261,9 +261,12 @@ minetest.register_chatcommand("teleport", {
|
||||||
}
|
}
|
||||||
for _, d in ipairs(tries) do
|
for _, d in ipairs(tries) do
|
||||||
local p = {x = pos.x+d.x, y = pos.y+d.y, z = pos.z+d.z}
|
local p = {x = pos.x+d.x, y = pos.y+d.y, z = pos.z+d.z}
|
||||||
local n = minetest.get_node(p)
|
local n = minetest.get_node_or_nil(p)
|
||||||
if not minetest.registered_nodes[n.name].walkable then
|
if n and n.name then
|
||||||
return p, true
|
local def = minetest.registered_nodes[n.name]
|
||||||
|
if def and not def.walkable then
|
||||||
|
return p, true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return pos, false
|
return pos, false
|
||||||
|
|
Loading…
Reference in New Issue