From 0f4bf6ac80113f346d4fdfdd2e5ae82c6e8a6465 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 25 Feb 2012 23:49:39 +0000 Subject: [PATCH] Don't assert in wxLocale::IsAvailable() if language is not supported. 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 97cb520a39..40d6fa1db5 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -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 ) -- 2.45.2