From 1446d4fcad269e93042bf7841c5afd1382f00bbc Mon Sep 17 00:00:00 2001 From: kay27 Date: Sun, 23 Jan 2022 23:37:01 +0400 Subject: [PATCH 1/2] #133 Fix unclear crash in mcl_wieldview --- mods/PLAYER/mcl_wieldview/init.lua | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mods/PLAYER/mcl_wieldview/init.lua b/mods/PLAYER/mcl_wieldview/init.lua index 7200f6186..b05896748 100644 --- a/mods/PLAYER/mcl_wieldview/init.lua +++ b/mods/PLAYER/mcl_wieldview/init.lua @@ -41,14 +41,19 @@ function mcl_wieldview.update_wielded_item(player) local def = mcl_wieldview.players[player] - if def.item == itemname then + if def and (def.item == itemname) then return end - def.item = itemname - def.texture = mcl_wieldview.get_item_texture(itemname) or "blank.png" + local texture = mcl_wieldview.get_item_texture(itemname) or "blank.png" - mcl_player.player_set_wielditem(player, def.texture) + local new_def = { + item = itemname, + texture = texture, + } + mcl_wieldview.players[player] = new_def + + mcl_player.player_set_wielditem(player, texture) end minetest.register_on_joinplayer(function(player) From 64d760df017c0110b9048a38e6562ac6e6f8abfe Mon Sep 17 00:00:00 2001 From: kay27 Date: Tue, 25 Jan 2022 20:32:14 +0400 Subject: [PATCH 2/2] #138 Skip nil index in mcl_shields --- mods/ITEMS/mcl_shields/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index dddaf24e5..9eebd3e80 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -173,9 +173,10 @@ local function set_shield(player, block, i) end end local shield = mcl_shields.players[player].shields[i] - if shield then - shield:get_luaentity()._blocking = block - end + if not shield then return end + local luaentity = shield:get_luaentity() + if not luaentity then return end + luaentity._blocking = block end local function set_interact(player, interact)