1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2024-12-26 10:40:39 +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:
Niklp 2024-03-17 09:11:03 +01:00 committed by GitHub
parent 7fc313f911
commit 25369e5165
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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