fix error if bad part name is given
Some checks failed
deploy / deploy (push) Failing after 37s

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

@ -22,7 +22,7 @@ jobs:
maven-version: 3.8.5 maven-version: 3.8.5
- name: Run Tests - name: Run Tests
run: mvn --batch-mode test run: mvn --batch-mode test -q
- name: Push to dokku - name: Push to dokku
uses: dokku/github-action@master uses: dokku/github-action@master

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