From 4f2789c498e35067633a5f12e41dcaef303615f8 Mon Sep 17 00:00:00 2001 From: iliekprogrammar Date: Sun, 7 Aug 2022 12:43:24 +0800 Subject: [PATCH] [5.6][armor] fix unsafe entity handling (unsure) i'm not sure about this one, can't fnd a suitable test for it. --- mods/ITEMS/mcl_armor/damage.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_armor/damage.lua b/mods/ITEMS/mcl_armor/damage.lua index e76f8034b5..012c323076 100644 --- a/mods/ITEMS/mcl_armor/damage.lua +++ b/mods/ITEMS/mcl_armor/damage.lua @@ -89,8 +89,9 @@ mcl_damage.register_modifier(function(obj, damage, reason) local thorns_damage = thorns_damage_regular + thorns_damage_irregular if thorns_damage > 0 and reason.type ~= "thorns" and reason.source ~= obj then - -- ERROR: [#2523] THIS WILL CAUSE INVALID OBJECTREFS mcl_util.deal_damage(reason.source, thorns_damage, {type = "thorns", direct = obj}) + -- mcl_util.deal_damage may remove object immediately + if not reason.source:get_pos() then return end local thorns_item = thorns_pieces[math.random(#thorns_pieces)]