Don't throw errors when loading chunks with invalid skulls (#4081)

* Don't throw errors with invalid skulls

* Move IllegalArgumentException check to loadFromJson() method
This commit is contained in:
chris 2023-08-24 23:32:25 +02:00 committed by GitHub
parent 9ddfdf9374
commit 90c4ea78a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -278,7 +278,14 @@ public class SkinManager {
} }
public static GameProfileData loadFromJson(String encodedJson) throws IOException, IllegalArgumentException { public static GameProfileData loadFromJson(String encodedJson) throws IOException, IllegalArgumentException {
JsonNode skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8)); JsonNode skinObject;
try {
skinObject = GeyserImpl.JSON_MAPPER.readTree(new String(Base64.getDecoder().decode(encodedJson), StandardCharsets.UTF_8));
} catch (IllegalArgumentException e) {
GeyserImpl.getInstance().getLogger().debug("Invalid base64 encoded skin entry: " + encodedJson);
return null;
}
JsonNode textures = skinObject.get("textures"); JsonNode textures = skinObject.get("textures");
if (textures == null) { if (textures == null) {