Merge pull request 'fire-HUD-crashfix' (#2093) from fire-HUD-crashfix into master

Reviewed-on: MineClone2/MineClone2#2093

Tested and verified it fixes the crash
This commit is contained in:
cora 2022-03-30 10:20:24 +00:00
commit ef7ebda90c
1 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,13 @@ end)
local function on_leaveplayer(player) local function on_leaveplayer(player)
local storage = mcl_burning.storage[player] local storage = mcl_burning.storage[player]
if not storage then
-- For some unexplained reasons, mcl_burning.storage can be `nil` here.
-- Logging this exception to assist in finding the cause of this.
minetest.log("warning", "on_leaveplayer: missing mcl_burning.storage "
.. "for player " .. player:get_player_name())
storage = {}
end
storage.fire_hud_id = nil storage.fire_hud_id = nil
player:get_meta():set_string("mcl_burning:data", minetest.serialize(storage)) player:get_meta():set_string("mcl_burning:data", minetest.serialize(storage))
mcl_burning.storage[player] = nil mcl_burning.storage[player] = nil