Skip to content

Commit

Permalink
Mitigate crash if metadata is not valid (disconnected player?)
Browse files Browse the repository at this point in the history
  • Loading branch information
S-S-X committed May 28, 2021
1 parent 9fa18c5 commit fc8c715
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ end

local function get_player_attribute(player, key)
if player.get_meta then
return player:get_meta():get_string(key)
local meta = player:get_meta()
return meta and meta:get_string(key) or ""
else
return player:get_attribute(key)
end
Expand Down

0 comments on commit fc8c715

Please sign in to comment.