set/check player name/existence first and then run

This commit is contained in:
Dirk Sohler 2017-03-01 18:33:29 +01:00
parent 8beb472234
commit 19bcb516ba

@ -55,14 +55,14 @@ end)
function _xtimer_changeText(player)
local playerName = player:get_player_name()
if playerName == '' then return end
-- Save the game-detected locale. Fun fact: changing the locale on runtime
-- from within a mod causes the UI to glitch out completely.
local currentLocale = os.setlocale(nil)
os.setlocale(_xtend.v.xtimer.format.locale)
local playerName = player:get_player_name()
if playerName == '' then return end
local startTime = _xtend.v.xtimer.playerData[playerName].startTime
local hudID = _xtend.v.xtimer.playerData[playerName].hudID