1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2024-12-27 19:20:39 +01:00

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

View File

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