From 487a53693fda846e7a86ad8a3385dbe760ee8944 Mon Sep 17 00:00:00 2001 From: "Alvin T. Veroy" Date: Thu, 20 Aug 2020 16:38:01 +0800 Subject: [PATCH] Added condition to check if the job is activated to prevent the error "@esx_service/server/main.lua:52: attempt to index a nil value (field '?')" (#17) * Fix for: SCRIPT ERROR: @esx_service/server/main.lua:52: attempt to index a nil value (field '?') Issue #9 * removed .vscode folder * fixed invalid condition statement on line 52 * Update server/main.lua Pushing the suggested change by @Dislaik. Co-authored-by: Matias Salas <42161973+Dislaik@users.noreply.github.com> Co-authored-by: Matias Salas <42161973+Dislaik@users.noreply.github.com> --- server/main.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/main.lua b/server/main.lua index 07233ce4..0c3ac488 100644 --- a/server/main.lua +++ b/server/main.lua @@ -49,8 +49,10 @@ end) ESX.RegisterServerCallback('esx_service:isInService', function(source, cb, name) local isInService = false - if InService[name][source] then - isInService = true + if InService[name] ~= nil then + if InService[name][source] then + isInService = true + end end cb(isInService)