Bug fix: delete offline account causes error

This commit is contained in:
Duy Tran Khanh 2021-01-17 09:26:41 +07:00
parent db0f1d39db
commit 1954f9633e
2 changed files with 5 additions and 1 deletions

View file

@ -783,7 +783,7 @@ public class PojavLoginActivity extends BaseActivity
@Override @Override
public void onClick(DialogInterface p1, int p2) { public void onClick(DialogInterface p1, int p2) {
new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName); new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName);
accountListLayout.removeViewsInLayout(0,1); accountListLayout.removeViewsInLayout(0, 1);
//Resize the window //Resize the window
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int) Math.min((yScreen*0.8), (73 + accountListLayout.getChildCount()*55)*(PojavLoginActivity.this.getResources().getDisplayMetrics().densityDpi/160f) )); accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int) Math.min((yScreen*0.8), (73 + accountListLayout.getChildCount()*55)*(PojavLoginActivity.this.getResources().getDisplayMetrics().densityDpi/160f) ));
} }

View file

@ -24,6 +24,10 @@ public class InvalidateTokenTask extends AsyncTask<String, Void, Throwable> {
public Throwable doInBackground(String... args) { public Throwable doInBackground(String... args) {
path = args[0]; path = args[0];
try { try {
if (profilePath.accessToken.equals("0")) {
return null;
}
this.profilePath = MinecraftAccount.load(args[0]); this.profilePath = MinecraftAccount.load(args[0]);
this.authenticator.invalidate(profilePath.accessToken, this.authenticator.invalidate(profilePath.accessToken,
UUID.fromString(profilePath.isMicrosoft ? profilePath.profileId : profilePath.clientToken /* should be? */)); UUID.fromString(profilePath.isMicrosoft ? profilePath.profileId : profilePath.clientToken /* should be? */));