mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix client hanging when default language cannot be determined
The loop was not terminating correctly, so the client hangs when the language index file is missing.
This commit is contained in:
parent
1112c9e6b7
commit
5db9f029e4
|
@ -148,6 +148,14 @@ void CLocalizationDatabase::LoadIndexfile(IStorage *pStorage, IConsole *pConsole
|
||||||
|
|
||||||
void CLocalizationDatabase::SelectDefaultLanguage(IConsole *pConsole, char *pFilename, size_t Length) const
|
void CLocalizationDatabase::SelectDefaultLanguage(IConsole *pConsole, char *pFilename, size_t Length) const
|
||||||
{
|
{
|
||||||
|
if(Languages().empty())
|
||||||
|
return;
|
||||||
|
if(Languages().size() == 1)
|
||||||
|
{
|
||||||
|
str_copy(pFilename, Languages()[0].m_FileName.c_str(), Length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
char aLocaleStr[128];
|
char aLocaleStr[128];
|
||||||
os_locale_str(aLocaleStr, sizeof(aLocaleStr));
|
os_locale_str(aLocaleStr, sizeof(aLocaleStr));
|
||||||
|
|
||||||
|
@ -194,7 +202,7 @@ void CLocalizationDatabase::SelectDefaultLanguage(IConsole *pConsole, char *pFil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop if no more locale segments are left
|
// Stop if no more locale segments are left
|
||||||
if(i == 0)
|
if(i <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue