mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-17 07:47:57 -04:00
Fix illegal texturePayload may cause crash
This commit is contained in:
parent
adc360eaaa
commit
43fb3ca10a
@ -165,7 +165,13 @@ public class YggdrasilService {
|
|||||||
String encodedTextures = profile.getProperties().get("textures");
|
String encodedTextures = profile.getProperties().get("textures");
|
||||||
|
|
||||||
if (encodedTextures != null) {
|
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);
|
return Optional.ofNullable(texturePayload.textures);
|
||||||
} else {
|
} else {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user