mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
fix(locale): always assign a table to dict
Prevent indexing nil when no locales exist for a resource.
This commit is contained in:
@@ -17,10 +17,7 @@ end
|
|||||||
local function loadLocale(locale)
|
local function loadLocale(locale)
|
||||||
local resourceName = GetCurrentResourceName()
|
local resourceName = GetCurrentResourceName()
|
||||||
local JSON = LoadResourceFile(resourceName, ('locales/%s.json'):format(locale)) or LoadResourceFile(resourceName, ('locales/en.json'):format(locale))
|
local JSON = LoadResourceFile(resourceName, ('locales/%s.json'):format(locale)) or LoadResourceFile(resourceName, ('locales/en.json'):format(locale))
|
||||||
|
dict = JSON and json.decode(JSON) or {}
|
||||||
if JSON then
|
|
||||||
dict = json.decode(JSON)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
AddEventHandler('ox_lib:setLocale', loadLocale)
|
AddEventHandler('ox_lib:setLocale', loadLocale)
|
||||||
|
|||||||
Reference in New Issue
Block a user