Merge pull request #1794 from ASTROWwwW/fix/esx-server-guards

fix(es_extended): guard getMoney and player load against missing data
This commit is contained in:
Arctos.
2026-06-24 03:25:39 +02:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -114,7 +114,8 @@ function CreateExtendedPlayer(playerId, identifier, ssn, group, accounts, invent
end
function self.getMoney()
return self.getAccount("money").money
local account = self.getAccount("money")
return account and account.money or 0
end
function self.addMoney(money, reason)
+5
View File
@@ -200,6 +200,11 @@ function loadESXPlayer(identifier, playerId, isNew)
local result = MySQL.prepare.await(loadPlayer, { identifier })
if not result then
print(("[^1ERROR^7] esx_core could not load data for identifier ^5%s^7"):format(identifier))
return DropPlayer(playerId --[[@as string]], "There was an error loading your character!\nError code: data-load-failed\n\nYour character data could not be retrieved. Please reconnect, and contact the server administration team if this keeps happening.")
end
-- Accounts
local accounts = result.accounts
accounts = (accounts and accounts ~= "") and json.decode(accounts) or {}