From e102fc7cea9daba84b2eadfec2abb080b7cd9645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20Gell=C3=A9rt?= Date: Sat, 22 Apr 2023 16:00:11 +0200 Subject: [PATCH] handle nil given parameter in Translate function --- [core]/es_extended/locale.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/[core]/es_extended/locale.lua b/[core]/es_extended/locale.lua index c093979e..18120067 100644 --- a/[core]/es_extended/locale.lua +++ b/[core]/es_extended/locale.lua @@ -1,6 +1,11 @@ Locales = {} function Translate(str, ...) -- Translate string + if not str then + local currentResourceName = GetCurrentResourceName() + print(("[^1ERROR^7] Resource ^5%s^7 You did not specify a parameter for the Translate function or the value is nil!"):format(currentResourceName)) + return 'Given translate function parameter is nil!' + end if Locales[Config.Locale] then if Locales[Config.Locale][str] then return string.format(Locales[Config.Locale][str], ...)