From 89e1b8891d76a8647b8902a203c5196dc2b1b059 Mon Sep 17 00:00:00 2001 From: capitalthree Date: Mon, 20 Nov 2023 05:13:18 -0600 Subject: [PATCH] avoid crash on searching invalid nodes --- rules.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rules.lua b/rules.lua index 61c1381..30a517d 100644 --- a/rules.lua +++ b/rules.lua @@ -37,16 +37,18 @@ function check_position(pos) end local ret = _check_position_uncached(pos) - print(ret) -- todo: remove this cache[hash] = ret return ret end function _check_position_uncached(pos) local node = minetest.get_node(pos) - 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 return "S" .. reg_item.go_team end