mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-11-22 20:43:43 +01:00
Add check for nil player inventory
This commit is contained in:
parent
672dbe1f54
commit
36688c74a8
@ -88,7 +88,11 @@ armor.set_player_armor = function(self, player)
|
||||
end
|
||||
local name = player:get_player_name()
|
||||
local player_inv = player:get_inventory()
|
||||
if not name or not player_inv then
|
||||
if not name then
|
||||
minetest.log("error", "Failed to read player name")
|
||||
return
|
||||
elseif not player_inv then
|
||||
minetest.log("error", "Failed to read player inventory")
|
||||
return
|
||||
end
|
||||
local armor_texture = "3d_armor_trans.png"
|
||||
@ -183,7 +187,11 @@ armor.update_armor = function(self, player)
|
||||
if self.player_hp[name] > hp then
|
||||
local player_inv = player:get_inventory()
|
||||
local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"})
|
||||
if not armor_inv then
|
||||
if not player_inv then
|
||||
minetest.log("error", "Failed to read player inventory")
|
||||
return
|
||||
elseif not armor_inv then
|
||||
minetest.log("error", "Failed to read detached inventory")
|
||||
return
|
||||
end
|
||||
local heal_max = 0
|
||||
|
Loading…
Reference in New Issue
Block a user