Don't crash when showing HUD to offline player

This makes the API more consistent with the formspec one
This commit is contained in:
luk3yx 2021-04-23 09:30:28 +12:00
parent 057d6ab4e3
commit 2235213e02
1 changed files with 1 additions and 0 deletions

View File

@ -320,6 +320,7 @@ local z_indexes = {}
function hud_fs.show_hud(player, formname, formspec)
if type(player) == "string" then
player = minetest.get_player_by_name(player)
if not player then return end
end
local name = player:get_player_name()