Add extra check to prevent skinsdb ServerError: AsyncErr: Lua: Runtime error

This commit is contained in:
Juraj Vajda 2024-01-04 18:48:19 -05:00
parent 39a37540f0
commit e5023d35b4

22
api.lua
View File

@ -2426,8 +2426,12 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
end end
if self.skinsdb then if self.skinsdb then
minetest.after(1, function() minetest.after(1, function(v_player)
local textures = player_api.get_textures(player) if not v_player then
return
end
local textures = player_api.get_textures(v_player)
---cleanup ---cleanup
for index, value in ipairs(textures) do for index, value in ipairs(textures) do
@ -2443,15 +2447,15 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
player_textures = textures player_textures = textures
if player_textures then if player_textures then
if _props.is_empty and not self.quiver_empty_state[player:get_player_name()] then if _props.is_empty and not self.quiver_empty_state[v_player:get_player_name()] then
self.quiver_empty_state[player:get_player_name()] = true self.quiver_empty_state[v_player:get_player_name()] = true
player_api.set_textures(player, player_textures) player_api.set_textures(v_player, player_textures)
elseif not _props.is_empty and self.quiver_empty_state[player:get_player_name()] then elseif not _props.is_empty and self.quiver_empty_state[v_player:get_player_name()] then
self.quiver_empty_state[player:get_player_name()] = false self.quiver_empty_state[v_player:get_player_name()] = false
player_api.set_textures(player, player_textures) player_api.set_textures(v_player, player_textures)
end end
end end
end) end, player)
return return
elseif self._3d_armor then elseif self._3d_armor then