Commit 471c536b authored by Michael Catanzaro's avatar Michael Catanzaro

gnome-languages: fix crashes on unexpected locales

I forgot to error-check the result of newlocale to make sure it's really
a valid locale.
parent 410b82ac
......@@ -710,6 +710,8 @@ get_translated_language (const char *code,
if (locale != NULL) {
loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
if (loc == (locale_t) 0)
return NULL;
old_locale = uselocale (loc);
}
......@@ -767,6 +769,8 @@ get_translated_territory (const char *code,
if (locale != NULL) {
loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0);
if (loc == (locale_t) 0)
return NULL;
old_locale = uselocale (loc);
}
......
......@@ -1600,6 +1600,8 @@ create_language_section (PrefsDialog *dialog)
g_autofree char *normalized_locale = normalize_locale (code);
if (normalized_locale != NULL) {
g_autofree char *language_name = language_for_locale (normalized_locale);
if (language_name == NULL)
language_name = g_strdup (normalized_locale);
language_editor_add (dialog, normalized_locale, language_name);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment