Skip to content
Permalink
Browse files

Fix crash when teleporting near unknown node

  • Loading branch information...
BlockMen committed Apr 11, 2014
1 parent 6090e95 commit fefec8cdc44b7fe32754053bac02c18cfe5a22f7
Showing with 6 additions and 3 deletions.
  1. +6 −3 builtin/chatcommands.lua
@@ -261,9 +261,12 @@ 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
return p, true
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

0 comments on commit fefec8c

Please sign in to comment.
You can’t perform that action at this time.