diff options
author | BlockMen <nmuelll@web.de> | 2014-04-11 21:38:16 +0200 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2014-04-11 21:38:16 +0200 |
commit | fefec8cdc44b7fe32754053bac02c18cfe5a22f7 (patch) | |
tree | 6172505cfa8ac1c135ed3eb54d218e437ed79d2c /builtin | |
parent | 6090e95cdcea7c0600ea75941289494505295cf2 (diff) | |
download | minetest-fefec8cdc44b7fe32754053bac02c18cfe5a22f7.tar.gz minetest-fefec8cdc44b7fe32754053bac02c18cfe5a22f7.tar.bz2 minetest-fefec8cdc44b7fe32754053bac02c18cfe5a22f7.zip |
Fix crash when teleporting near unknown node
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/chatcommands.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/chatcommands.lua b/builtin/chatcommands.lua index 03c278d4d..f8df83d8e 100644 --- a/builtin/chatcommands.lua +++ b/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 |