Fix potential crashes due to timing
This commit is contained in:
parent
7cdacc4b44
commit
6ecbcd0a84
@ -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
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user