avoid crash on searching invalid nodes

pull/1/head
capitalthree 1 year ago
parent 30868bec31
commit 89e1b8891d
  1. 6
      rules.lua

@ -37,16 +37,18 @@ function check_position(pos)
end end
local ret = _check_position_uncached(pos) local ret = _check_position_uncached(pos)
print(ret) -- todo: remove this
cache[hash] = ret cache[hash] = ret
return ret return ret
end end
function _check_position_uncached(pos) function _check_position_uncached(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local reg_item = minetest.registered_items[node.name] local reg_item = minetest.registered_items[node.name]
if not reg_item then
return "W"
end
if reg_item.groups and reg_item.groups.go_stone then if reg_item.groups and reg_item.groups.go_stone then
return "S" .. reg_item.go_team return "S" .. reg_item.go_team
end end

Loading…
Cancel
Save