[gnome-control-center] common: Add safeguards for empty language



commit 8ca85762de3ed4fd4df1547259bfbb012182e393
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jul 7 16:34:08 2011 +0100

    common: Add safeguards for empty language
    
    NULL or empty languages aren't useful.

 panels/common/gdm-languages.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/panels/common/gdm-languages.c b/panels/common/gdm-languages.c
index fa2f040..69cb302 100644
--- a/panels/common/gdm-languages.c
+++ b/panels/common/gdm-languages.c
@@ -147,7 +147,7 @@ gdm_parse_language_name (const char *name,
 
         if (!g_regex_match (re, name, 0, &match_info) ||
             g_match_info_is_partial_match (match_info)) {
-                g_warning ("locale %s isn't valid\n", name);
+                g_warning ("locale '%s' isn't valid\n", name);
                 goto out;
         }
 
@@ -367,6 +367,7 @@ add_locale (const char *language_name,
         gboolean   is_utf8;
 
         g_return_val_if_fail (language_name != NULL, FALSE);
+        g_return_val_if_fail (*language_name != '\0', FALSE);
 
         language_name_get_codeset_details (language_name, NULL, &is_utf8);
 
@@ -1061,6 +1062,9 @@ gdm_get_language_from_name (const char *name,
         char *translated_territory;
         gboolean is_utf8 = TRUE;
 
+        g_return_val_if_fail (name != NULL, NULL);
+        g_return_val_if_fail (*name != '\0', NULL);
+
         translated_territory = NULL;
         translated_language = NULL;
         langinfo_codeset = NULL;



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