Skip to content

NOISSUE Fix valid account check when starting instance #5648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions launcher/LaunchController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,25 @@ void LaunchController::decideAccount()
return;
}

// Find an account to use.
// Find a valid account to use.
auto accounts = APPLICATION->accounts();
if (accounts->count() <= 0)
bool hasAValidAccount = false;
for (int i = 0; i < accounts.get()->count(); i++) {
auto currentAccount = accounts.get()->at(i);
if (currentAccount.isAccount && currentAccount.account != nullptr) {
hasAValidAccount = true;
break;
}
}

if (!hasAValidAccount)
{
// Tell the user they need to log in at least one account in order to play.
auto reply = CustomMessageBox::selectable(
m_parentWidget,
tr("No Accounts"),
tr("In order to play Minecraft, you must have at least one Mojang or Minecraft "
"account logged in."
tr("In order to play Minecraft, you must have at least one Minecraft account "
"logged in. "
"Would you like to open the account manager to add an account now?"),
QMessageBox::Information,
QMessageBox::Yes | QMessageBox::No
Expand All @@ -69,7 +78,7 @@ void LaunchController::decideAccount()
if (reply == QMessageBox::Yes)
{
// Open the account manager.
APPLICATION->ShowGlobalSettings(m_parentWidget, "accounts");
APPLICATION->ShowAccountsDialog(m_parentWidget);
}
}

Expand Down