X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6ba36e4648baa76ed2f7f68f584197978ebb96e..d730bd8a68c9e19fc3e2be13777ae267408a3833:/src/common/intl.cpp?ds=sidebyside diff --git a/src/common/intl.cpp b/src/common/intl.cpp index a1f81ebec7..896533d2a4 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -1177,6 +1177,9 @@ static wxString GetFullSearchPath(const wxString& lang) bool wxMsgCatalogFile::Load(const wxString& szDirPrefix, const wxString& szName, wxPluralFormsCalculatorPtr& rPluralFormsCalculator) { + wxCHECK_MSG( szDirPrefix.length() >= LEN_LANG, false, + "invalid language specification" ); + wxString searchPath; #if wxUSE_FONTMAP @@ -2570,6 +2573,16 @@ bool wxLocale::AddCatalog(const wxString& szDomain, const wxString& msgIdCharset) { + wxCHECK_MSG( IsOk(), false, "must initialize catalog first" ); + + + // It is OK to not load catalog if the msgid language and m_language match, + // in which case we can directly display the texts embedded in program's + // source code: + if ( msgIdLanguage == m_language ) + return true; + + wxMsgCatalog *pMsgCat = new wxMsgCatalog; if ( pMsgCat->Load(m_strShort, szDomain, msgIdCharset, m_bConvertEncoding) ) @@ -2586,12 +2599,6 @@ bool wxLocale::AddCatalog(const wxString& szDomain, delete pMsgCat; - // It is OK to not load catalog if the msgid language and m_language match, - // in which case we can directly display the texts embedded in program's - // source code: - if ( msgIdLanguage == m_language ) - return true; - // If there's no exact match, we may still get partial match where the // (basic) language is same, but the country differs. For example, it's // permitted to use en_US strings from sources even if m_language is en_GB: