1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-10-31 23:30:31 +01:00

Fix nil deref issue with people hitting chests too often.

This commit is contained in:
Auke Kok 2017-05-06 21:15:34 -07:00 committed by Auke Kok
parent a533434b58
commit 55f81d0802

View File

@ -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