Fix crash in translations code when no translations are found
Fix another regression in wxTranslations in 3.1.2 and check that the vector of acceptable translations is not empty before using its first element. Closes https://github.com/wxWidgets/wxWidgets/pull/1082 Closes #18299.
This commit is contained in:
parent
14e905858d
commit
80904d1bc7
@ -1676,9 +1676,9 @@ wxString wxTranslations::GetBestTranslation(const wxString& domain,
|
||||
const wxString& msgIdLanguage)
|
||||
{
|
||||
const wxArrayString allGoodOnes = GetAcceptableTranslations(domain, msgIdLanguage);
|
||||
|
||||
wxLogTrace(TRACE_I18N, " => using language '%s'", allGoodOnes[0]);
|
||||
return allGoodOnes[0];
|
||||
wxString best(allGoodOnes.empty() ? wxString() : allGoodOnes[0]);
|
||||
wxLogTrace(TRACE_I18N, " => using language '%s'", best);
|
||||
return best;
|
||||
}
|
||||
|
||||
wxArrayString wxTranslations::GetAcceptableTranslations(const wxString& domain,
|
||||
|
Loading…
Reference in New Issue
Block a user