[gnome-control-center/wip/jtojnar/region-fixes: 11/12] region: Fix creating rows for locales without country




commit 7c4428eb592b28afb148261a1e1d87cdf812bb70
Author: Jan Tojnar <jtojnar gmail com>
Date:   Fri May 20 01:34:35 2022 +0200

    region: Fix creating rows for locales without country
    
    When creating a language row for Esperanto (eo.UTF-8), gnome-desktop throws a critical:
    
        gnome_get_country_from_code: assertion 'code != NULL' failed

 panels/common/cc-language-row.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/panels/common/cc-language-row.c b/panels/common/cc-language-row.c
index 3b9620561..a2832df56 100644
--- a/panels/common/cc-language-row.c
+++ b/panels/common/cc-language-row.c
@@ -112,9 +112,17 @@ cc_language_row_new (const gchar *locale_id)
   self->language_local = get_language_label (language_code, modifier, NULL);
   gtk_label_set_label (self->language_label, self->language);
 
-  self->country = gnome_get_country_from_code (country_code, locale_id);
-  self->country_local = gnome_get_country_from_code (country_code, NULL);
-  gtk_label_set_label (self->country_label, self->country);
+  if (country_code == NULL)
+    {
+      self->country = NULL;
+      self->country_local = NULL;
+    }
+  else
+    {
+      self->country = gnome_get_country_from_code (country_code, locale_id);
+      self->country_local = gnome_get_country_from_code (country_code, NULL);
+      gtk_label_set_label (self->country_label, self->country);
+    }
 
   return self;
 }


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