[gnome-desktop] Fix crash if default background not found



commit 443f4a5e32cde614d106f4ec635efd1549b0a378
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Aug 20 14:04:47 2012 +0200

    Fix crash if default background not found
    
    Its a hard error (i.e. crash) if you return FALSE from
    the final fallback in a g_settings_get_mapped map function.
    Fix that by returning TRUE with a NULL result.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682252

 libgnome-desktop/gnome-bg.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 6e20903..9cd1ab0 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -299,6 +299,12 @@ bg_gsettings_mapping (GVariant *value,
 	const gchar *bg_key_value;
 	char *filename = NULL;
 
+	/* The final fallback if nothing matches is with a NULL value. */
+	if (value == NULL) {
+		*result = NULL;
+		return TRUE;
+	}
+
 	bg_key_value = g_variant_get_string (value, NULL);
 
 	if (bg_key_value && *bg_key_value != '\0') {



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