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



commit 6c35f0a430096afa91b1182dc1d5c3a9c3bde3b7
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 d035037..eec1224 100644
--- a/libgnome-desktop/gnome-xkb-info.c
+++ b/libgnome-desktop/gnome-xkb-info.c
@@ -977,6 +977,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);
@@ -1022,6 +1024,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]