check for removed player variable

fixes https://github.com/pandorabox-io/pandorabox.io/issues/467
This commit is contained in:
BuckarooBanzay 2020-04-28 08:03:14 +02:00
parent 004e19acc0
commit b367fb0f65

@ -39,8 +39,14 @@ end)
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
for _, player in pairs(minetest.get_connected_players()) do for _, player in pairs(minetest.get_connected_players()) do
local player_name = player:get_player_name() local player_name = player:get_player_name()
if not controls.players[player_name] then
local player_controls = player:get_player_control() local player_controls = player:get_player_control()
for cname, cbool in pairs(player_controls) do for cname, cbool in pairs(player_controls) do
if not controls.players[player_name] then
-- player timed out but is still provided by get_connected_players(), disregard
break
end
--Press a key --Press a key
if cbool==true and controls.players[player_name][cname][1]==false then if cbool==true and controls.players[player_name][cname][1]==false then
for _, func in pairs(controls.registered_on_press) do for _, func in pairs(controls.registered_on_press) do