mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 00:59:35 -04:00
[New account data] Add null check for accessToken and profileId
This commit is contained in:
parent
b74b0389c3
commit
181fd87244
@ -146,9 +146,9 @@ public final class Tools
|
|||||||
gameDir.mkdirs();
|
gameDir.mkdirs();
|
||||||
|
|
||||||
Map<String, String> varArgMap = new ArrayMap<String, String>();
|
Map<String, String> varArgMap = new ArrayMap<String, String>();
|
||||||
varArgMap.put("auth_access_token", profile.accessToken == null ? "0" : profile.accessToken);
|
varArgMap.put("auth_access_token", profile.accessToken);
|
||||||
varArgMap.put("auth_player_name", username);
|
varArgMap.put("auth_player_name", username);
|
||||||
varArgMap.put("auth_uuid", profile.profileId == null ? "0" : profile.profileId);
|
varArgMap.put("auth_uuid", profile.profileId);
|
||||||
varArgMap.put("assets_root", Tools.ASSETS_PATH);
|
varArgMap.put("assets_root", Tools.ASSETS_PATH);
|
||||||
varArgMap.put("assets_index_name", versionInfo.assets);
|
varArgMap.put("assets_index_name", versionInfo.assets);
|
||||||
varArgMap.put("game_assets", Tools.ASSETS_PATH);
|
varArgMap.put("game_assets", Tools.ASSETS_PATH);
|
||||||
|
@ -5,13 +5,13 @@ import com.google.gson.*;
|
|||||||
|
|
||||||
public class MinecraftAccount
|
public class MinecraftAccount
|
||||||
{
|
{
|
||||||
public String accessToken; // access token
|
public String accessToken = "0"; // access token
|
||||||
public String clientToken; // clientID: refresh and invalidate
|
public String clientToken = "0"; // clientID: refresh and invalidate
|
||||||
public String profileId; // authenticate UUID
|
public String profileId = "0"; // authenticate UUID
|
||||||
public String username;
|
public String username = "Steve";
|
||||||
public String selectedVersion = "1.7.10";
|
public String selectedVersion = "1.7.10";
|
||||||
public boolean isMicrosoft;
|
public boolean isMicrosoft = false;
|
||||||
public String msaRefreshToken;
|
public String msaRefreshToken = "0";
|
||||||
|
|
||||||
public String save(String outPath) throws IOException {
|
public String save(String outPath) throws IOException {
|
||||||
Tools.write(outPath, Tools.GLOBAL_GSON.toJson(this));
|
Tools.write(outPath, Tools.GLOBAL_GSON.toJson(this));
|
||||||
@ -27,7 +27,13 @@ public class MinecraftAccount
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static MinecraftAccount load(String path) throws IOException, JsonSyntaxException {
|
public static MinecraftAccount load(String path) throws IOException, JsonSyntaxException {
|
||||||
return parse(Tools.read(path));
|
MinecraftAccount acc = parse(Tools.read(path));
|
||||||
|
if (acc.accessToken == null) {
|
||||||
|
acc.accessToken = "0";
|
||||||
|
} if (acc.profileId == null) {
|
||||||
|
acc.profileId = "0";
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearTempAccount() {
|
public static void clearTempAccount() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user