add nil check in armor.damage

This commit is contained in:
Buckaroo Banzai 2023-08-04 07:28:58 +02:00 committed by GitHub
parent dfa19cce98
commit fed2087238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -631,6 +631,9 @@ end
armor.damage = function(self, player, index, stack, use)
local old_stack = ItemStack(stack)
local worn_armor = armor:get_weared_armor_elements(player)
if not worn_armor then
return
end
local armor_worn_cnt = 0
for k,v in pairs(worn_armor) do
armor_worn_cnt = armor_worn_cnt + 1