summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2017-02-25 02:04:15 +0100
committerWuzzy <almikes@aol.com>2017-02-25 02:04:15 +0100
commitea58a71e17ad29a5e6b69cacf1d7ff2d424d18d6 (patch)
tree45c3d3bffcc77aeed8c8a3b0e3e83f44f54648f8
parente11a52d8fba15ec04226d4659a8aeb9dc59eb632 (diff)
Fix crash HP changed before player was registered
-rw-r--r--init.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 6bcc624..89d8b1c 100644
--- a/init.lua
+++ b/init.lua
@@ -521,7 +521,11 @@ local function update_hud(player)
end
end
-minetest.register_on_player_hpchange(update_health)
+minetest.register_on_player_hpchange(function(player)
+ if hb.players[player:get_player_name()] ~= nil then
+ update_health(player)
+ end
+end)
minetest.register_on_respawnplayer(function(player)
update_health(player)