Fix fatal bug in wxXLocale initialization

Ensure that m_locale is always initialized to null pointer, as it could
remain not initialized at all if information for wxLanguage could be
found, but its locale name was empty, which resulted in a crash in dtor
when the wxXLocale object was destroyed as freelocale() was called with
an invalid pointer.
This commit is contained in:
Vadim Zeitlin
2017-12-10 00:03:39 +01:00
parent aa4d51d579
commit 5e429702bf

View File

@@ -90,12 +90,10 @@ wxXLocale& wxXLocale::GetCLocale()
#if wxUSE_INTL
wxXLocale::wxXLocale(wxLanguage lang)
{
m_locale = NULL;
const wxLanguageInfo * const info = wxLocale::GetLanguageInfo(lang);
if ( !info )
{
m_locale = NULL;
}
else
if ( info )
{
Init(info->GetLocaleName().c_str());
}