]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't assert in wxLocale::IsAvailable() if language is not supported.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Feb 2012 23:49:39 +0000 (23:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 25 Feb 2012 23:49:39 +0000 (23:49 +0000)
We can fail to find language information if we're called with
wxLANGUAGE_DEFAULT and we don't support the current system language.

Closes #14039.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/intl.cpp

index 97cb520a397b9eec5f633b859419c6512d36672f..40d6fa1db5b73720507786742641b009962b7fa1 100644 (file)
@@ -1033,7 +1033,14 @@ wxLocale::~wxLocale()
 bool wxLocale::IsAvailable(int lang)
 {
     const wxLanguageInfo *info = wxLocale::GetLanguageInfo(lang);
-    wxCHECK_MSG( info, false, wxS("invalid language") );
+    if ( !info )
+    {
+        // The language is unknown (this normally only happens when we're
+        // passed wxLANGUAGE_DEFAULT), so we can't support it.
+        wxASSERT_MSG( lang == wxLANGUAGE_DEFAULT,
+                      wxS("No info for a valid language?") );
+        return false;
+    }
 
 #if defined(__WIN32__)
     if ( !info->WinLang )