add nil check in armor.damage (#109)

This commit is contained in:
Buckaroo Banzai 2023-08-04 16:35:02 +02:00 committed by GitHub
parent dfa19cce98
commit 6eb492b09c
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) armor.damage = function(self, player, index, stack, use)
local old_stack = ItemStack(stack) local old_stack = ItemStack(stack)
local worn_armor = armor:get_weared_armor_elements(player) local worn_armor = armor:get_weared_armor_elements(player)
if not worn_armor then
return
end
local armor_worn_cnt = 0 local armor_worn_cnt = 0
for k,v in pairs(worn_armor) do for k,v in pairs(worn_armor) do
armor_worn_cnt = armor_worn_cnt + 1 armor_worn_cnt = armor_worn_cnt + 1