mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 23:59:21 -04:00
fix[MinecraftAccount.load()]: Fix crash when accounts.json is malformed
This commit is contained in:
parent
66db228605
commit
7670c5cf89
@ -13,6 +13,7 @@ import android.graphics.Bitmap;
|
||||
import android.util.Base64;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
@ -68,7 +69,7 @@ public class MinecraftAccount {
|
||||
public static MinecraftAccount parse(String content) throws JsonSyntaxException {
|
||||
return Tools.GLOBAL_GSON.fromJson(content, MinecraftAccount.class);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static MinecraftAccount load(String name) {
|
||||
if(!accountExists(name)) return null;
|
||||
try {
|
||||
@ -92,7 +93,7 @@ public class MinecraftAccount {
|
||||
acc.msaRefreshToken = "0";
|
||||
}
|
||||
return acc;
|
||||
} catch(IOException | JsonSyntaxException e) {
|
||||
} catch(NullPointerException | IOException | JsonSyntaxException e) {
|
||||
Log.e(MinecraftAccount.class.getName(), "Caught an exception while loading the profile",e);
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user