fix undefined node crash

This commit is contained in:
Vanessa Ezekowitz 2014-08-24 11:51:43 -04:00
parent 42a364b818
commit bbc530a067

View File

@ -253,8 +253,10 @@ local function go_next(pos, velocity, stack)
for _, vect in ipairs(can_go) do
local npos = vector.add(pos, vect)
local node = minetest.get_node(npos)
local reg_node = minetest.registered_nodes[node.name]
if reg_node then
local tube_def = reg_node.tube
local tubedevice = minetest.get_item_group(node.name, "tubedevice")
local tube_def = minetest.registered_nodes[node.name].tube
local tube_priority = (tube_def and tube_def.priority) or 100
if tubedevice > 0 and tube_priority >= max_priority then
if not tube_def or not tube_def.can_insert or
@ -267,6 +269,7 @@ local function go_next(pos, velocity, stack)
end
end
end
end
if not next_positions[1] then
return false, nil