[epiphany/gnome-3-32] prefs-dialog: Don't crash when locale has no language name



commit 28f41ec6fc78efb59366c21ca0f97b6018d4d4e0
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Mar 7 10:35:25 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 display such languages
    in the current locale, instead of translated like all other languages in
    the list, which would look wrong and awkward. We'd also need to make
    undesirable modifications to the gnome-desktop code. 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..db1eaa87b 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]