From 37fadc9099484477918a0ee07110670b528a040e Mon Sep 17 00:00:00 2001 From: Araca Date: Sun, 4 Feb 2024 21:59:12 +0100 Subject: [PATCH] Fix crash with cape when player has default skin --- mods/PLAYER/mcl_skins/edit_skin.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/mods/PLAYER/mcl_skins/edit_skin.lua b/mods/PLAYER/mcl_skins/edit_skin.lua index 8531e4263..57e2655a8 100644 --- a/mods/PLAYER/mcl_skins/edit_skin.lua +++ b/mods/PLAYER/mcl_skins/edit_skin.lua @@ -163,13 +163,15 @@ function mcl_skins.update_player_skin(player) local skin = mcl_skins.player_skins[player] local skinval = mcl_skins.compile_skin(skin) - if not skin.cape then skin.cape = "blank.png" end - - if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" then - skinval = skinval:gsub("%^" .. skin.cape, "") - -- don't render the "normal" cape on players while wearing the elytra. - -- this is NOT used when the player puts an elytra on, see register.lua in mcl_armor for that. - -- this is used when a player joins or changes something regarding their skin. + if skin then + if not skin.cape then skin.cape = "blank.png" end + + if player:get_inventory():get_stack("armor", 3):get_name() == "mcl_armor:elytra" then + skinval = skinval:gsub("%^" .. skin.cape, "") + -- don't render the "normal" cape on players while wearing the elytra. + -- this is NOT used when the player puts an elytra on, see register.lua in mcl_armor for that. + -- this is used when a player joins or changes something regarding their skin. + end end mcl_player.player_set_skin(player, skinval)