1
0
Fork 0

Put in check to prevent Trying to Reference a Nil error in Apply_Modifier.

This commit is contained in:
Michieal 2023-12-08 20:38:07 -05:00 committed by the-real-herowl
parent 4f3f59f4bc
commit 2f8389d3f5
1 changed files with 7 additions and 3 deletions

View File

@ -74,8 +74,10 @@ function mcl_fovapi.apply_modifier(player, modifier_name)
if mcl_fovapi.registered_modifiers[modifier_name] == nil then
return
end
if mcl_fovapi.applied_modifiers[player][modifier_name] and mcl_fovapi.applied_modifiers[player][modifier_name] == true then
return
if mcl_fovapi.applied_modifiers ~= nil and mcl_fovapi.applied_modifiers[player] ~= nil and mcl_fovapi.applied_modifiers[player][modifier_name] ~= nil then
if mcl_fovapi.applied_modifiers[player][modifier_name] and mcl_fovapi.applied_modifiers[player][modifier_name] == true then
return
end
end
local modifier = mcl_fovapi.registered_modifiers[modifier_name]
@ -113,7 +115,9 @@ function mcl_fovapi.remove_modifier(player, modifier_name)
return
end
if mcl_fovapi.applied_modifiers[player][modifier_name] == nil then return end
if mcl_fovapi.applied_modifiers[player][modifier_name] == nil then
return
end
if DEBUG then
local name = player:get_player_name()