From 7ff8c00b1b5bb208d63bf3144ef91cb214141963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Fri, 1 Jun 2018 09:18:53 +0200 Subject: 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. --- hunger.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hunger.lua b/hunger.lua index effd25d..aeb4093 100644 --- a/hunger.lua +++ b/hunger.lua @@ -76,6 +76,10 @@ 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 -- cgit v1.2.3