Fix memory leak in mcl_craftguide

This commit is contained in:
Wuzzy 2017-12-08 11:29:25 +01:00
parent d9a8403e11
commit faafaadc54
1 changed files with 6 additions and 0 deletions

View File

@ -530,6 +530,8 @@ mt.register_on_player_receive_fields(function(player, formname, fields)
data.pagenum = 1 data.pagenum = 1
data.iX = data.iX - (fields.size_dec and 1 or -1) data.iX = data.iX - (fields.size_dec and 1 or -1)
craftguide:get_formspec(player_name) craftguide:get_formspec(player_name)
elseif (fields.quit) then
datas[player_name] = nil
else else
for item in pairs(fields) do for item in pairs(fields) do
if item:find(":") then if item:find(":") then
@ -597,3 +599,7 @@ mt.register_on_player_receive_fields(function(player, formname, fields)
craftguide:on_use(player) craftguide:on_use(player)
end end
end) end)
mt.register_on_leaveplayer(function(player)
datas[player:get_player_name()] = nil
end)