Skip to content

Commit

Permalink
fix(server/modules/createJob): skin nil check before json encode
Browse files Browse the repository at this point in the history
Added checks for skin_male and skin_female before json encoding to prevent 'NULL' entries in database
  • Loading branch information
t1ger-scripts authored Feb 18, 2025
1 parent 364dfc0 commit 5ddd200
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion [core]/es_extended/server/modules/createJob.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function ESX.CreateJob(name, label, grades)
for _, grade in pairs(grades) do
queries[#queries + 1] = {
query = 'INSERT INTO job_grades (job_name, grade, name, label, salary, skin_male, skin_female) VALUES (?, ?, ?, ?, ?, ?, ?)',
values = { name, grade.grade, grade.name, grade.label, grade.salary, json.encode(grade.skin_male) or '{}', json.encode(grade.skin_female) or '{}' }
values = { name, grade.grade, grade.name, grade.label, grade.salary, grade.skin_male and json.encode(grade.skin_male) or '{}', grade.skin_female and json.encode(grade.skin_female) or '{}' }
}
end

Expand Down

0 comments on commit 5ddd200

Please sign in to comment.