summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel PĂ©rez-Cerezo <gabriel@gpcf.eu>2018-06-01 11:58:52 +0200
committerWuzzy <Wuzzy2@mail.ru>2018-06-01 11:58:52 +0200
commit4e8621632a4b98d8d5c3bfc90a75ae2a68fc701d (patch)
treef01759454245ea0f60a9896d74813fd385892f80
parentdd2f4c9c6d9738a01436722f74d2fe961f1a02ae (diff)
Fixed bug with node breakers
This bug fix fixes a crash that happened whenever someone was operating a node breaker with something edible inside the tool slot, and the operator player is absent.
-rw-r--r--hunger.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/hunger.lua b/hunger.lua
index effd25d..37eaefa 100644
--- a/hunger.lua
+++ b/hunger.lua
@@ -76,6 +76,9 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound
local name = user:get_player_name()
local h = tonumber(hbhunger.hunger[name])
local hp = user:get_hp()
+ if h == nil or hp == nil then
+ return
+ end
minetest.sound_play({name = sound or "hbhunger_eat_generic", gain = 1}, {pos=user:getpos(), max_hear_distance = 16})
-- Saturation