Skip to content

Commit fefec8c

Browse files
committedApr 11, 2014
Fix crash when teleporting near unknown node
1 parent 6090e95 commit fefec8c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎builtin/chatcommands.lua

+6-3
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,12 @@ minetest.register_chatcommand("teleport", {
261261
}
262262
for _, d in ipairs(tries) do
263263
local p = {x = pos.x+d.x, y = pos.y+d.y, z = pos.z+d.z}
264-
local n = minetest.get_node(p)
265-
if not minetest.registered_nodes[n.name].walkable then
266-
return p, true
264+
local n = minetest.get_node_or_nil(p)
265+
if n and n.name then
266+
local def = minetest.registered_nodes[n.name]
267+
if def and not def.walkable then
268+
return p, true
269+
end
267270
end
268271
end
269272
return pos, false

0 commit comments

Comments
 (0)