[gnome-desktop/gnome-3-8] gnome-xkb-info: Prevent a crash with unknown language/country codes



commit 3b11ac82000d52bf859d8b4997fe2a9c3da81a0b
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Aug 13 10:53:16 2013 +0200

    gnome-xkb-info: Prevent a crash with unknown language/country codes
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705885

 libgnome-desktop/gnome-xkb-info.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-xkb-info.c b/libgnome-desktop/gnome-xkb-info.c
index 41e962f..9fdf40b 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -973,6 +973,8 @@ gnome_xkb_info_get_layouts_for_language (GnomeXkbInfo *self,
     return NULL;
 
   language = gnome_get_language_from_code (language_code, NULL);
+  if (!language)
+    return NULL;
 
   layouts_for_language = g_hash_table_lookup (priv->layouts_by_language, language);
   g_free (language);
@@ -1018,6 +1020,8 @@ gnome_xkb_info_get_layouts_for_country (GnomeXkbInfo *self,
     return NULL;
 
   country = gnome_get_country_from_code (country_code, NULL);
+  if (!country)
+    return NULL;
 
   layouts_for_country = g_hash_table_lookup (priv->layouts_by_country, country);
   g_free (country);


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