Fix potential crashes due to timing

This commit is contained in:
Wuzzy 2019-08-30 20:32:18 +02:00
parent 7cdacc4b44
commit 6ecbcd0a84
2 changed files with 8 additions and 0 deletions

View File

@ -74,6 +74,10 @@ if minetest.settings:get_bool("ambiance_enable") == true then
for soundname, sound in pairs(ambiance.sounds) do
if not minetest.settings:get_bool("ambiance_disable_" .. soundname) then
if lastsound[name] == nil then
-- lastsound is not initialized yet
return
end
if lastsound[name][soundname] then
lastsound[name][soundname] = lastsound[name][soundname] + dtime
else

View File

@ -163,6 +163,10 @@ local function step(dtime)
local gt = minetest.get_gametime()
if player_effects.effects == nil then
return
end
for _, player in pairs(minetest.get_connected_players()) do
local name = player:get_player_name()