Fix mcl_shields is_blocking crash when object not found under player

This commit is contained in:
James Clarke 2024-01-09 01:06:49 +00:00 committed by the-real-herowl
parent c70ae8e535
commit f94e7fc52f
1 changed files with 2 additions and 0 deletions

View File

@ -112,6 +112,7 @@ end
function mcl_shields.is_blocking(obj) function mcl_shields.is_blocking(obj)
if not obj:is_player() then return end if not obj:is_player() then return end
if mcl_shields.players[obj] then
local blocking = mcl_shields.players[obj].blocking local blocking = mcl_shields.players[obj].blocking
if blocking <= 0 then if blocking <= 0 then
return return
@ -123,6 +124,7 @@ function mcl_shields.is_blocking(obj)
end end
return blocking, shieldstack return blocking, shieldstack
end end
end
mcl_damage.register_modifier(function(obj, damage, reason) mcl_damage.register_modifier(function(obj, damage, reason)
local type = reason.type local type = reason.type