Skip to content

Commit

Permalink
fix(storage/players): avoid json decoding error when a citizenid does…
Browse files Browse the repository at this point in the history
…n't exist (#595)
  • Loading branch information
citRaTTV authored Oct 10, 2024
1 parent e224721 commit d029fab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/storage/players.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ end
local function fetchPlayerEntity(citizenId)
---@type PlayerEntityDatabase
local player = MySQL.single.await('SELECT citizenid, license, name, charinfo, money, job, gang, position, metadata, UNIX_TIMESTAMP(last_logged_out) AS lastLoggedOutUnix FROM players WHERE citizenid = ?', { citizenId })
local charinfo = json.decode(player.charinfo)
local charinfo = player and json.decode(player.charinfo)
return player and {
citizenid = player.citizenid,
license = player.license,
Expand Down

0 comments on commit d029fab

Please sign in to comment.