Check that player inventory returns a valid table

This commit is contained in:
stujones11 2017-10-20 20:17:37 +01:00
parent d979815a49
commit d5896a04e2

View File

@ -199,7 +199,10 @@ armor.set_player_armor = function(self, player)
change[group] = 1 change[group] = 1
levels[group] = 0 levels[group] = 0
end end
local list = player_inv:get_list("armor") or {} local list = player_inv:get_list("armor")
if type(list) ~= "table" then
return
end
for i, stack in pairs(list) do for i, stack in pairs(list) do
if stack:get_count() == 1 then if stack:get_count() == 1 then
local def = stack:get_definition() local def = stack:get_definition()