From 6c83adfda82428fa7b3e5c4c59748cf6674b13e9 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sun, 19 Jun 2022 17:34:32 +1000 Subject: [PATCH] fix(locale): always assign a table to dict Prevent indexing nil when no locales exist for a resource. --- imports/locale/shared.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/imports/locale/shared.lua b/imports/locale/shared.lua index 1ae4e63..3e86b30 100644 --- a/imports/locale/shared.lua +++ b/imports/locale/shared.lua @@ -17,10 +17,7 @@ end local function loadLocale(locale) local resourceName = GetCurrentResourceName() local JSON = LoadResourceFile(resourceName, ('locales/%s.json'):format(locale)) or LoadResourceFile(resourceName, ('locales/en.json'):format(locale)) - - if JSON then - dict = json.decode(JSON) - end + dict = JSON and json.decode(JSON) or {} end AddEventHandler('ox_lib:setLocale', loadLocale)