fix crash when logging out active account

This commit is contained in:
sk 2023-05-31 10:05:31 +02:00
parent 2858aeb55e
commit 5e7a00de3e
1 changed files with 9 additions and 1 deletions

View File

@ -194,8 +194,16 @@ public class AccountSwitcherSheet extends BottomSheet{
private void onLoggedOut(String accountID){ private void onLoggedOut(String accountID){
AccountSessionManager.getInstance().removeAccount(accountID); AccountSessionManager.getInstance().removeAccount(accountID);
String activeAccountID = fragment != null
? fragment.getAccountID()
: AccountSessionManager.getInstance().getLastActiveAccountID();
if (accountID.equals(activeAccountID)) {
activity.finish();
activity.startActivity(new Intent(activity, MainActivity.class));
} else {
dismiss(); dismiss();
} }
}
@Override @Override
protected void onWindowInsetsUpdated(WindowInsets insets){ protected void onWindowInsetsUpdated(WindowInsets insets){