From: Auke Kok Date: Sun, 7 May 2017 04:15:34 +0000 (-0700) Subject: Fix nil deref issue with people hitting chests too often. X-Git-Tag: 0.4.16~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=55f81d08020ceb91a15ba2b4b94de6a4c0772656;p=oweals%2Fminetest_game.git Fix nil deref issue with people hitting chests too often. --- 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