mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 17:14:18 +00:00
Fix crash when the serverlist request fails
We're not allowed to look at `ResultAgeSeconds` when the state is `EHttpState::ERROR`. Fixes #8107.
This commit is contained in:
parent
67cbac8b7c
commit
03aab986fe
|
@ -400,19 +400,22 @@ void CServerBrowserHttp::Update()
|
||||||
Success = Success && pJson;
|
Success = Success && pJson;
|
||||||
Success = Success && !Parse(pJson, &m_vServers, &m_vLegacyServers);
|
Success = Success && !Parse(pJson, &m_vServers, &m_vLegacyServers);
|
||||||
json_value_free(pJson);
|
json_value_free(pJson);
|
||||||
int Age = SanitizeAge(pGetServers->ResultAgeSeconds());
|
|
||||||
if(!Success)
|
if(!Success)
|
||||||
{
|
{
|
||||||
log_error("serverbrowse_http", "failed getting serverlist, trying to find best URL");
|
log_error("serverbrowse_http", "failed getting serverlist, trying to find best URL");
|
||||||
m_pChooseMaster->Reset();
|
m_pChooseMaster->Reset();
|
||||||
m_pChooseMaster->Refresh();
|
m_pChooseMaster->Refresh();
|
||||||
}
|
}
|
||||||
// Try to find new master if the current one returns results
|
else
|
||||||
// that are 5 minutes old.
|
|
||||||
else if(Age > 300)
|
|
||||||
{
|
{
|
||||||
log_info("serverbrowse_http", "got stale serverlist, age=%ds, trying to find best URL", Age);
|
// Try to find new master if the current one returns
|
||||||
m_pChooseMaster->Refresh();
|
// results that are 5 minutes old.
|
||||||
|
int Age = SanitizeAge(pGetServers->ResultAgeSeconds());
|
||||||
|
if(Age > 300)
|
||||||
|
{
|
||||||
|
log_info("serverbrowse_http", "got stale serverlist, age=%ds, trying to find best URL", Age);
|
||||||
|
m_pChooseMaster->Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue