mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-11-11 13:00:30 +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
|
end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local player_inv = player:get_inventory()
|
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
|
return
|
||||||
end
|
end
|
||||||
local armor_texture = "3d_armor_trans.png"
|
local armor_texture = "3d_armor_trans.png"
|
||||||
|
@ -183,7 +187,11 @@ armor.update_armor = function(self, player)
|
||||||
if self.player_hp[name] > hp then
|
if self.player_hp[name] > hp then
|
||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
local armor_inv = minetest.get_inventory({type="detached", name=name.."_armor"})
|
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
|
return
|
||||||
end
|
end
|
||||||
local heal_max = 0
|
local heal_max = 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user