Permalink
Browse files

Avoid a segfault in the language selection prompt if no translations …

…have been installed.
  • Loading branch information...
1 parent 17a73ed commit 5b56d64205e57c7ff19c9cbd1f3ed57e24ae1c87 @stuartm stuartm committed Jun 11, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 mythtv/libs/libmyth/langsettings.cpp
@@ -127,6 +127,18 @@ void LanguageSelection::Load(void)
}
}
+ if (m_languageList->IsEmpty())
+ {
+ LOG(VB_GUI, LOG_ERR, "ERROR - Failed to load translations, at least "
+ "one translation file MUST be installed.");
+
+ item = new MythUIButtonListItem(m_languageList,
+ "English (United States)");
+ item->SetText("English (United States)", "language");
+ item->SetText("English (United States)", "nativelanguage");
+ item->SetData("en_US");
+ }
+
if (!foundLanguage)
m_languageList->SetValueByData("en_US");
@@ -186,6 +198,9 @@ void LanguageSelection::Save(void)
{
MythUIButtonListItem *item = m_languageList->GetItemCurrent();
+ if (!item)
+ Close();
+
QString langCode = item->GetData().toString();
gCoreContext->SaveSetting("Language", langCode);

0 comments on commit 5b56d64

Please sign in to comment.