mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-12-26 18:50:40 +01:00
Don't assume hitter ~= nil
in on_punchplayer callback (#138)
* Don't assume `hitter ~= nil` in on_punchplayer callback * Use early return
This commit is contained in:
parent
7fc313f911
commit
25369e5165
@ -394,6 +394,9 @@ end
|
||||
if armor.config.punch_damage == true then
|
||||
minetest.register_on_punchplayer(function(player, hitter,
|
||||
time_from_last_punch, tool_capabilities)
|
||||
if hitter == nil then
|
||||
return
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local hit_ip = hitter:is_player()
|
||||
if name and hit_ip and minetest.is_protected(player:get_pos(), "") then
|
||||
|
Loading…
Reference in New Issue
Block a user