From 2ce811efa695463fa7ef0b22d89e94ff14c07467 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Wed, 13 Apr 2016 21:08:54 -0400 Subject: [PATCH] Check that server skin data is complete. --- .../com/voxelmodpack/hdskins/HDSkinManager.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java index 56acd768..c16f0b59 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java @@ -61,9 +61,16 @@ public final class HDSkinManager { Property prop = Iterables.getFirst(profile1.getProperties().get("textures"), null); if (prop != null) { JsonObject obj = new Gson().fromJson(new String(Base64.decodeBase64(prop.getValue())), JsonObject.class); - String name = obj.get("profileName").getAsString(); - UUID uuid = UUIDTypeAdapter.fromString(obj.get("profileId").getAsString()); - profile1 = new GameProfile(uuid, name); + String name = null; + // this should be optional + if (obj.has("profileName")) { + name = obj.get("profileName").getAsString(); + } + // this is required + if (obj.has("profileId")) { + UUID uuid = UUIDTypeAdapter.fromString(obj.get("profileId").getAsString()); + profile1 = new GameProfile(uuid, name); + } } final GameProfile profile = profile1;