fix error if bad part name is given

This commit is contained in:
Lee
2024-04-08 07:33:14 +01:00
parent 33d966057f
commit 88da585d47
2 changed files with 4 additions and 2 deletions

View File

@ -47,7 +47,9 @@ public class PlayerController {
if (player != null) { // The player exists
Skin skin = player.getSkin();
Skin.Parts skinPart = Skin.Parts.fromName(part);
partBytes = PlayerUtils.getSkinPartBytes(skin, skinPart, size);
if (skinPart != null) { // The part exists
partBytes = PlayerUtils.getSkinPartBytes(skin, skinPart, size);
}
}
if (partBytes == null) { // Fallback to the default head
partBytes = PlayerUtils.getSkinPartBytes(Skin.DEFAULT_SKIN, Skin.Parts.HEAD, size);