Validate player identifier in DeleteCharacter function

This commit is contained in:
zykem
2025-07-26 19:36:11 +02:00
committed by GitHub
parent 25b5a3d7a1
commit e315272e48
@@ -73,7 +73,14 @@ MySQL.ready(function()
end)
function Database:DeleteCharacter(source, charid)
local identifier = ("%s%s:%s"):format(Server.prefix, charid, ESX.GetIdentifier(source))
local playerIdentifier = ESX.GetIdentifier(source)
if not playerIdentifier then
local name = GetPlayerName(source) or "Unknown"
print(("[^1ERROR^7] Failed to delete character for ^5%s %s^7: invalid or missing identifier"):format(name, source))
return
end
local identifier = ("%s%s:%s"):format(Server.prefix, charid, playerIdentifier)
local query = "DELETE FROM `%s` WHERE %s = ?"
local queries = {}
local count = 0
@@ -141,4 +148,4 @@ function Database:DisableSlot(identifier, slot)
return updated > 0
end
Database:GetConnection()
Database:GetConnection()