From 71fb8d662a318564bd1338c151f09f35cf4aa834 Mon Sep 17 00:00:00 2001 From: Moresteck Date: Fri, 25 Oct 2024 10:15:08 +0000 Subject: [PATCH] Fix NPE when the player has no cape --- src/main/java/uk/betacraft/legacyfix/util/SkinUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/uk/betacraft/legacyfix/util/SkinUtils.java b/src/main/java/uk/betacraft/legacyfix/util/SkinUtils.java index 9fcabf6..8270483 100644 --- a/src/main/java/uk/betacraft/legacyfix/util/SkinUtils.java +++ b/src/main/java/uk/betacraft/legacyfix/util/SkinUtils.java @@ -88,8 +88,8 @@ public static SkinData fetchSkin(String uuid) { byte[] cape; byte[] skin = RequestUtil.readInputStream(skinUrl.openStream()); - JSONObject capeObj = textures.getJSONObject("CAPE"); - if (capeObj != null) { + if (textures.has("CAPE")) { + JSONObject capeObj = textures.getJSONObject("CAPE"); URL capeUrl = new URL(capeObj.getString("url")); cape = RequestUtil.readInputStream(capeUrl.openStream());