diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java index cac9ce7a6..b08e8fc81 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilService.java @@ -165,7 +165,13 @@ public class YggdrasilService { String encodedTextures = profile.getProperties().get("textures"); if (encodedTextures != null) { - TextureResponse texturePayload = fromJson(new String(Base64.getDecoder().decode(encodedTextures), UTF_8), TextureResponse.class); + byte[] decodedBinary; + try { + decodedBinary = Base64.getDecoder().decode(encodedTextures); + } catch (IllegalArgumentException e) { + throw new ServerResponseMalformedException(e); + } + TextureResponse texturePayload = fromJson(new String(decodedBinary, UTF_8), TextureResponse.class); return Optional.ofNullable(texturePayload.textures); } else { return Optional.empty();