fix for a crash due to using NULL inputConv in Unicode build introduced in rev 1.162

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-09-28 09:41:55 +00:00
parent 43dc5fb140
commit f15fa3a93f

View File

@@ -1254,14 +1254,23 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
if ( convertEncoding ) if ( convertEncoding )
{ {
if ( m_charset.empty() ) if ( m_charset.empty() )
{
inputConv = wxConvCurrent; inputConv = wxConvCurrent;
}
else else
{
inputConv = inputConv =
csConv = new wxCSConv(m_charset); csConv = new wxCSConv(m_charset);
} }
else // no conversion needed }
else // no need to convert the encoding
{ {
// we still need the conversion for Unicode build
#if wxUSE_UNICODE
inputConv = wxConvCurrent;
#else // !wxUSE_UNICODE
inputConv = NULL; inputConv = NULL;
#endif // wxUSE_UNICODE/!wxUSE_UNICODE
} }
// conversion to apply to msgid strings before looking them up: we only // conversion to apply to msgid strings before looking them up: we only
@@ -1315,11 +1324,11 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
wxString msgid(data, *inputConv); wxString msgid(data, *inputConv);
#else // ASCII #else // ASCII
wxString msgid; wxString msgid;
#if wxUSE_WCHAR_T #if wxUSE_WCHAR_T
if ( inputConv && sourceConv ) if ( inputConv && sourceConv )
msgid = wxString(inputConv->cMB2WC(data), *sourceConv); msgid = wxString(inputConv->cMB2WC(data), *sourceConv);
else else
#endif #endif
msgid = data; msgid = data;
#endif // wxUSE_UNICODE #endif // wxUSE_UNICODE