From 55f81d08020ceb91a15ba2b4b94de6a4c0772656 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Sat, 6 May 2017 21:15:34 -0700 Subject: [PATCH] Fix nil deref issue with people hitting chests too often. --- mods/default/nodes.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index c410b213..a1da9216 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -1801,11 +1801,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= "default:chest" then return end - if not fields.quit then + if not player or not fields.quit then return end local pn = player:get_player_name() + if not open_chests[pn] then + return + end + local pos = open_chests[pn].pos local sound = open_chests[pn].sound local swap = open_chests[pn].swap