[gnome-initial-setup/shell/4765: 223/362] language: don't call g_variant_dup_string() on a NULL variant



commit ec173b605dc496fa7b2131a0f1c60cfe1e8e6aae
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Tue Sep 16 17:14:37 2014 -0700

    language: don't call g_variant_dup_string() on a NULL variant
    
    g_dbus_proxy_get_cached_property() can return NULL. Guard against that
    case.
    
    [endlessm/eos-shell#3639]

 .../pages/language/cc-common-language.c            |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/cc-common-language.c 
b/gnome-initial-setup/pages/language/cc-common-language.c
index 0591e87..6ee2ab3 100644
--- a/gnome-initial-setup/pages/language/cc-common-language.c
+++ b/gnome-initial-setup/pages/language/cc-common-language.c
@@ -161,10 +161,14 @@ get_lang_for_user_object_path (const char *path)
                g_error_free (error);
                return NULL;
        }
+
+       lang = NULL;
        props = g_dbus_proxy_get_cached_property (user, "Language");
-       lang = g_variant_dup_string (props, NULL);
+       if (props != NULL) {
+               lang = g_variant_dup_string (props, NULL);
+               g_variant_unref (props);
+       }
 
-       g_variant_unref (props);
        g_object_unref (user);
        return lang;
 }


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