[epiphany/mcatanzaro/locale-crash: 2/2] prefs-dialog: Don't crash when locale has no language name



commit e3f75936fc5271b4f347f27e25c0286e1630b709
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Wed Mar 6 21:14:55 2019 -0600

    prefs-dialog: Don't crash when locale has no language name
    
    It's expected that sometimes we might not be able to retrieve a language
    name from a given locale. In that case, we could either ignore the
    locale, or just give up on displaying a name for it.
    
    We could, if we really wanted to, try harder, assume it's a language
    code, and look up the right name for the language code. This is what we
    used to do in Epiphany 3.30. But then we have to add back our iso-codes
    dependency, and the language name would have to be displayed in the
    current locale rather than the target locale (since, without a country
    code, it's not a valid glibc locale and we can't translate it). Since
    modern Epiphany doesn't allow creating such locales, and this only
    affects users who used the language dialog in older versions of Epiphany
    -- probably a very small minority of users -- there's probably no need
    to bother with this.

 src/prefs-dialog.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 9ef2e5515..bd36daccb 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -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);
       }
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]