summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Browaeys <alban.browaeys@gmail.com>2023-01-03 01:36:35 +0100
committerMichael Catanzaro <mcatanzaro@gnome.org>2023-01-18 13:48:32 +0000
commitb27558e422a60a170b3ae37436c67554a970342d (patch)
tree489ac4b2d1ed6b160d5949453923272e922112bc
parenta81c190750e44375bc8773c4c427751da02c82f8 (diff)
downloadgnome-desktop-b27558e422a60a170b3ae37436c67554a970342d.tar.gz
gnome-languages: skip territory if no translation available
If the locale for the requested translation is not installed, get_translated_territory will return null. Bail out of the gnome_get_country_from_locale routine in this case. Fixes GNOME Settings region panel format-chooser spewing warnings (gnome-control-center:1426300): GLib-CRITICAL **: 23:27:53.759: g_string_insert_len: assertion 'len == 0 || val != NULL' failed when one of the locale listed in its cc_common_language_get_initial_languages routine is not installed, namely: "en_US.UTF-8" "en_GB.UTF-8" "de_DE.UTF-8" "fr_FR.UTF-8" "es_ES.UTF-8" "zh_CN.UTF-8" "ja_JP.UTF-8" "ru_RU.UTF-8" "ar_EG.UTF-8" Fixes gnome-control-center#1791
-rw-r--r--libgnome-desktop/gnome-languages.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libgnome-desktop/gnome-languages.c b/libgnome-desktop/gnome-languages.c
index 6d5ae48e..adfc4eee 100644
--- a/libgnome-desktop/gnome-languages.c
+++ b/libgnome-desktop/gnome-languages.c
@@ -1182,6 +1182,10 @@ gnome_get_country_from_locale (const char *locale,
}
translated_territory = get_translated_territory (territory_code, translation);
+ if (translated_territory == NULL) {
+ goto out;
+ }
+
g_string_append (full_name, translated_territory);
if (is_unique_territory (territory_code)) {