Don't crash if login without --init-user

This commit is contained in:
Benau 2019-02-10 14:20:42 +08:00
parent 061d4becc5
commit 9ad2823f4d

View File

@ -1058,6 +1058,12 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
bool can_wan = false; bool can_wan = false;
if (!login.empty() && !password.empty()) if (!login.empty() && !password.empty())
{ {
if (!PlayerManager::getCurrentPlayer())
{
Log::error("Main", "Run supertuxkart with --init-user");
cleanSuperTuxKart();
return false;
}
irr::core::stringw s; irr::core::stringw s;
PlayerManager::requestSignIn(login, password); PlayerManager::requestSignIn(login, password);
while (PlayerManager::getCurrentOnlineState() != PlayerProfile::OS_SIGNED_IN) while (PlayerManager::getCurrentOnlineState() != PlayerProfile::OS_SIGNED_IN)