From 88da585d472303a5eab141e424649703a157f2df Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 8 Apr 2024 07:33:14 +0100 Subject: [PATCH] fix error if bad part name is given --- .gitea/workflows/ci.yml | 2 +- src/main/java/cc/fascinated/controller/PlayerController.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2573d8f..67a5cb2 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: maven-version: 3.8.5 - name: Run Tests - run: mvn --batch-mode test + run: mvn --batch-mode test -q - name: Push to dokku uses: dokku/github-action@master diff --git a/src/main/java/cc/fascinated/controller/PlayerController.java b/src/main/java/cc/fascinated/controller/PlayerController.java index f2ddd79..338f465 100644 --- a/src/main/java/cc/fascinated/controller/PlayerController.java +++ b/src/main/java/cc/fascinated/controller/PlayerController.java @@ -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);