[Backport release-11.x] Fix offline accounts not being refreshed during launch (#5576)

This commit is contained in:
Alexandru Ionut Tripon 2026-05-27 18:36:14 +03:00 committed by GitHub
commit 5cf7b4629f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -133,14 +133,6 @@ LaunchDecision LaunchController::decideLaunchMode()
return LaunchDecision::Continue;
}
if (m_wantedLaunchMode == LaunchMode::Normal) {
if (m_accountToUse->shouldRefresh() || m_accountToUse->accountState() == AccountState::Offline) {
// Force account refresh on the account used to launch the instance updating the AccountState
// only on first try and if it is not meant to be offline
m_accountToUse->refresh();
}
}
const auto* accounts = APPLICATION->accounts();
MinecraftAccountPtr accountToCheck = nullptr;
@ -163,7 +155,9 @@ LaunchDecision LaunchController::decideLaunchMode()
}
auto state = accountToCheck->accountState();
if (state == AccountState::Unchecked || state == AccountState::Errored) {
const bool needsRefresh =
m_wantedLaunchMode == LaunchMode::Normal && (state == AccountState::Offline || accountToCheck->shouldRefresh());
if (state == AccountState::Unchecked || state == AccountState::Errored || needsRefresh) {
accountToCheck->refresh();
state = AccountState::Working;
}