[nautilus-actions] Do not try to dump a null value
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Do not try to dump a null value
- Date: Wed, 14 Apr 2010 18:48:53 +0000 (UTC)
commit 40e00ce55c70bec5666dacbdc263f4375d44b0ed
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Apr 14 20:48:06 2010 +0200
Do not try to dump a null value
This fixes a Nautilus crash which occurred when reloading items after a save in NACT.
ChangeLog | 3 ++
src/core/na-gconf-utils.c | 54 ++++++++++++++++++++++++--------------------
2 files changed, 32 insertions(+), 25 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a678534..efaf44b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2009-04-14 Pierre Wieser <pwieser trychlos org>
+ * src/core/na-gconf-utils.c (dump_entry):
+ Do not try to dump a null value.
+
* src/core/na-selected-info.c
(dump): New function.
(na_selected_info_create_for_uri): Accepts a mimetype.
diff --git a/src/core/na-gconf-utils.c b/src/core/na-gconf-utils.c
index e8dd566..5acb432 100644
--- a/src/core/na-gconf-utils.c
+++ b/src/core/na-gconf-utils.c
@@ -296,41 +296,45 @@ static void
dump_entry( GConfEntry *entry, void *user_data )
{
static const gchar *thisfn = "na_gconf_utils_dump_entry";
+ gchar *str = NULL;
+ gboolean str_free = FALSE;
gchar *key = g_path_get_basename( gconf_entry_get_key( entry ));
GConfValue *value = gconf_entry_get_value( entry );
- gchar *str;
- gboolean str_free = FALSE;
- switch( value->type ){
- case GCONF_VALUE_STRING:
- str = ( gchar * ) gconf_value_get_string( value );
- break;
-
- case GCONF_VALUE_INT:
- str = g_strdup_printf( "%d", gconf_value_get_int( value ));
- str_free = TRUE;
- break;
-
- case GCONF_VALUE_FLOAT:
- str = g_strdup_printf( "%f", gconf_value_get_float( value ));
- str_free = TRUE;
- break;
-
- case GCONF_VALUE_BOOL:
- str = g_strdup_printf( "%s", gconf_value_get_bool( value ) ? "True":"False" );
- str_free = TRUE;
- break;
-
- default:
- str = g_strdup( "(undetermined value)" );
- str_free = TRUE;
+ if( value ){
+ switch( value->type ){
+ case GCONF_VALUE_STRING:
+ str = ( gchar * ) gconf_value_get_string( value );
+ break;
+
+ case GCONF_VALUE_INT:
+ str = g_strdup_printf( "%d", gconf_value_get_int( value ));
+ str_free = TRUE;
+ break;
+
+ case GCONF_VALUE_FLOAT:
+ str = g_strdup_printf( "%f", gconf_value_get_float( value ));
+ str_free = TRUE;
+ break;
+
+ case GCONF_VALUE_BOOL:
+ str = g_strdup_printf( "%s", gconf_value_get_bool( value ) ? "True":"False" );
+ str_free = TRUE;
+ break;
+
+ default:
+ str = g_strdup( "(undetermined value)" );
+ str_free = TRUE;
+ }
}
+
g_debug( "%s: key=%s, value=%s", thisfn, key, str );
if( str_free ){
g_free( str );
}
+
g_free( key );
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]