Skip to content

Commit

Permalink
Fix #4931
Browse files Browse the repository at this point in the history
The assert could be triggered when a new sign-in request was sent before the first one was resolved, usually when using the enter key to request the sign in. Since it can happen in normal operations to have the player profile status different from signing out or signed out, an assert is incorrect.

Also fix server-only compilation for the previous commit.
  • Loading branch information
Alayan-stk-2 committed Apr 28, 2024
1 parent 01d62be commit e64e2d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/online/online_player_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ namespace Online
m_online_state = OS_SIGNED_OUT;
m_token = "";
m_profile = NULL;

} // OnlinePlayerProfile

// ------------------------------------------------------------------------
Expand Down Expand Up @@ -136,10 +135,11 @@ namespace Online
void OnlinePlayerProfile::requestSignIn(const core::stringw &username,
const core::stringw &password)
{
// If the player changes the online account, there can be a
// logout stil happening.
assert(m_online_state == OS_SIGNED_OUT ||
m_online_state == OS_SIGNING_OUT);
// Avoid multiple sign in requests from happening at once,
// this can occur for example when using the enter key to request a sign-in.
if (m_online_state != OS_SIGNED_OUT && m_online_state != OS_SIGNING_OUT)
return;

auto request = std::make_shared<PrivateRequest::SignInRequest>();

// We can't use setUserDetail here, since there is no token yet
Expand Down
2 changes: 2 additions & 0 deletions src/states_screens/options/options_screen_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
} // scale_rtts
else if (name == "benchmarkCurrent")
{
#ifndef SERVER_ONLY
// TODO - Add the possibility to benchmark more tracks and define replay benchmarks in
// a config file
const std::string bf_bench("benchmark_black_forest.replay");
Expand Down Expand Up @@ -961,6 +962,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
{
startBenchmark();
}
#endif
} // benchmarkCurrent
// TODO - Add a standard benchmark testing multiple presets
/*else if (name == "benchmarkStandard")
Expand Down

0 comments on commit e64e2d8

Please sign in to comment.