add nil check

main
tenplus1 2021-02-08 20:30:28 +00:00
parent 294ddbf283
commit d597cf488c
1 changed files with 2 additions and 2 deletions

View File

@ -405,13 +405,13 @@ local function stamina_globaltimer(dtime)
local name = player:get_player_name()
-- damage player by 1 hp if saturation is < 2 (of 30)
if h < STAMINA_STARVE_LVL
if h and h < STAMINA_STARVE_LVL
and hp > 0 then
player:set_hp(hp - STAMINA_STARVE, {hunger = true})
end
-- don't heal if drowning or dead or poisoned
if h >= STAMINA_HEAL_LVL
if h and h >= STAMINA_HEAL_LVL
and h >= hp
and hp > 0
and air > 0