From 2d521a0b6e17e2adf0ea9312999ce4b29c4177c4 Mon Sep 17 00:00:00 2001 From: Jens Granseuer Date: Sun, 1 Jul 2007 15:01:23 +0000 Subject: [PATCH] add safeguards for NULL values (closes bug #441036) 2007-07-01 Jens Granseuer * gconf-property-editor.c: (peditor_string_value_changed), (peditor_color_value_changed): add safeguards for NULL values (closes bug #441036) svn path=/trunk/; revision=7810 --- capplets/common/ChangeLog | 6 ++++++ capplets/common/gconf-property-editor.c | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog index a4d0fab01..30cfc2672 100644 --- a/capplets/common/ChangeLog +++ b/capplets/common/ChangeLog @@ -1,3 +1,9 @@ +2007-07-01 Jens Granseuer + + * gconf-property-editor.c: (peditor_string_value_changed), + (peditor_color_value_changed): add safeguards for NULL values (closes + bug #441036) + 2007-06-29 Jens Granseuer * gconf-property-editor.c: (peditor_string_value_changed): compare the diff --git a/capplets/common/gconf-property-editor.c b/capplets/common/gconf-property-editor.c index 81c9ae4e3..a0017c0e4 100644 --- a/capplets/common/gconf-property-editor.c +++ b/capplets/common/gconf-property-editor.c @@ -597,15 +597,19 @@ peditor_string_value_changed (GConfClient *client, GConfPropertyEditor *peditor) { GConfValue *value, *value_wid; - const char *entry_current_text; if (peditor->p->changeset != NULL) gconf_change_set_remove (peditor->p->changeset, peditor->p->key); if (entry && (value = gconf_entry_get_value (entry))) { + const char *entry_current_text; + const char *gconf_text; + value_wid = peditor->p->conv_to_widget_cb (peditor, value); + gconf_text = gconf_value_get_string (value_wid); entry_current_text = gtk_entry_get_text (GTK_ENTRY (peditor->p->ui_control)); - if (strcmp (entry_current_text, gconf_value_get_string (value_wid)) != 0) { + + if (gconf_text && strcmp (entry_current_text, gconf_text) != 0) { gtk_entry_set_text (GTK_ENTRY (peditor->p->ui_control), gconf_value_get_string (value_wid)); } gconf_value_free (value_wid); @@ -713,16 +717,21 @@ peditor_color_value_changed (GConfClient *client, GConfPropertyEditor *peditor) { GConfValue *value, *value_wid; - GdkColor color; if (peditor->p->changeset != NULL) gconf_change_set_remove (peditor->p->changeset, peditor->p->key); if (entry && (value = gconf_entry_get_value (entry))) { + const gchar *spec; + value_wid = peditor->p->conv_to_widget_cb (peditor, value); - gdk_color_parse (gconf_value_get_string (value_wid), &color); - gtk_color_button_set_color ( - GTK_COLOR_BUTTON (peditor->p->ui_control), &color); + spec = gconf_value_get_string (value_wid); + if (spec) { + GdkColor color; + gdk_color_parse (gconf_value_get_string (value_wid), &color); + gtk_color_button_set_color ( + GTK_COLOR_BUTTON (peditor->p->ui_control), &color); + } gconf_value_free (value_wid); } }