[gnome-control-center/wip/jtojnar/region-fixes: 1/2] region: Fix creating rows for locales without country
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gnome-control-center/wip/jtojnar/region-fixes: 1/2] region: Fix creating rows for locales without country
- Date: Sat, 21 May 2022 00:12:39 +0000 (UTC)
commit a0d0a225a442753279921c2be49f4a20daa9d575
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 | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/panels/common/cc-language-row.c b/panels/common/cc-language-row.c
index 3b9620561..201bf7e48 100644
--- a/panels/common/cc-language-row.c
+++ b/panels/common/cc-language-row.c
@@ -112,9 +112,14 @@ 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]