Fix crash after some time

This commit is contained in:
Lars Mueller 2020-11-28 15:47:11 +01:00
parent b915226444
commit bfcc16d67e

@ -126,19 +126,21 @@ function remove_last_kill_msg_from_hud(listname, x_offset)
local name=player:get_player_name() local name=player:get_player_name()
local hud_ids=list[name] local hud_ids=list[name]
local i=#list[name] local i=#list[name]
if mode=="list" then if i > 0 then
player:hud_remove(hud_ids[i]) if mode=="list" then
hud_ids[i]=nil player:hud_remove(hud_ids[i])
else hud_ids[i]=nil
player:hud_remove(hud_ids[1]) -- Will be replaced else
for j=2,i do player:hud_remove(hud_ids[1]) -- Will be replaced
local new={x=hud_base_offset.x+x_offset,y=hud_base_offset.y-((j-2)*20)} for j=2,i do
player:hud_change(hud_ids[j],"offset",new) local new={x=hud_base_offset.x+x_offset,y=hud_base_offset.y-((j-2)*20)}
hud_ids[j-1]=hud_ids[j] -- Perform index shift player:hud_change(hud_ids[j],"offset",new)
hud_ids[j-1]=hud_ids[j] -- Perform index shift
end
hud_ids[i]=nil
end end
hud_ids[i]=nil list[name]=hud_ids
end end
list[name]=hud_ids
end end
end end