From 25d847f49f2c5aea8670e1a1b95446d2248aa40b Mon Sep 17 00:00:00 2001 From: NO11 Date: Tue, 31 May 2022 12:12:28 +0200 Subject: [PATCH] Fix crash when unknown item in offhand slot --- mods/HUD/mcl_offhand/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_offhand/init.lua b/mods/HUD/mcl_offhand/init.lua index b0fc223ec..5f48eede9 100644 --- a/mods/HUD/mcl_offhand/init.lua +++ b/mods/HUD/mcl_offhand/init.lua @@ -59,8 +59,9 @@ minetest.register_globalstep(function(dtime) local itemstack = mcl_offhand.get_offhand(player) local offhand_item = itemstack:get_name() local offhand_hud = mcl_offhand[player].hud - if offhand_item ~= "" then - local item_texture = minetest.registered_items[offhand_item].inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px + local item = minetest.registered_items[offhand_item] + if offhand_item ~= "" and item then + local item_texture = item.inventory_image .. "^[resize:" .. max_offhand_px .. "x" .. max_offhand_px local position = {x = 0.5, y = 1} local offset = {x = -320, y = -32}