mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-11-23 07:16:39 +01:00
Fix rare NPE in skin handling code (#3357)
This commit is contained in:
parent
ece1b2a8ce
commit
e8764c6a81
1 changed files with 19 additions and 14 deletions
|
@ -258,21 +258,26 @@ public class SkinManager {
|
|||
JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8));
|
||||
JsonNode textures = skinObject.get("textures");
|
||||
|
||||
if (textures != null) {
|
||||
JsonNode skinTexture = textures.get("SKIN");
|
||||
String skinUrl = skinTexture.get("url").asText().replace("http://", "https://");
|
||||
|
||||
boolean isAlex = skinTexture.has("metadata");
|
||||
|
||||
String capeUrl = null;
|
||||
JsonNode capeTexture = textures.get("CAPE");
|
||||
if (capeTexture != null) {
|
||||
capeUrl = capeTexture.get("url").asText().replace("http://", "https://");
|
||||
}
|
||||
|
||||
return new GameProfileData(skinUrl, capeUrl, isAlex);
|
||||
if (textures == null) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
||||
JsonNode skinTexture = textures.get("SKIN");
|
||||
if (skinTexture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String skinUrl = skinTexture.get("url").asText().replace("http://", "https://");
|
||||
|
||||
boolean isAlex = skinTexture.has("metadata");
|
||||
|
||||
String capeUrl = null;
|
||||
JsonNode capeTexture = textures.get("CAPE");
|
||||
if (capeTexture != null) {
|
||||
capeUrl = capeTexture.get("url").asText().replace("http://", "https://");
|
||||
}
|
||||
|
||||
return new GameProfileData(skinUrl, capeUrl, isAlex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue