From 25369e5165d46f9dcc205078ce72d85afea3cfc3 Mon Sep 17 00:00:00 2001 From: Niklp Date: Sun, 17 Mar 2024 09:11:03 +0100 Subject: [PATCH] Don't assume `hitter ~= nil` in on_punchplayer callback (#138) * Don't assume `hitter ~= nil` in on_punchplayer callback * Use early return --- 3d_armor/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/3d_armor/init.lua b/3d_armor/init.lua index 62ca087..1a4028a 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -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