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