$NetBSD$

--- src/sj-prefs.c.orig	2010-04-13 18:06:56.000000000 +0000
+++ src/sj-prefs.c
@@ -171,8 +171,8 @@ void prefs_edit_profile_clicked (GtkButt
 static void audio_profile_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
 {
   const char *value;
-  g_return_if_fail (strcmp (entry->key, GCONF_AUDIO_PROFILE) == 0);
-  if (!entry->value) return;
+  g_return_if_fail (!entry || strcmp (entry->key, GCONF_AUDIO_PROFILE) == 0);
+  if (!entry || !entry->value) return;
   value = gconf_value_get_string (entry->value);
   
   /* If the value is empty, unset the combo. Otherwise try and set it. */
@@ -193,10 +193,10 @@ static void baseuri_changed_cb (GConfCli
    * into sj-utils?
    */
   const char* base_uri, *current_uri;
-  g_return_if_fail (strcmp (entry->key, GCONF_BASEURI) == 0);
+  g_return_if_fail (!entry || strcmp (entry->key, GCONF_BASEURI) == 0);
 
   base_uri = NULL;
-  if (entry->value != NULL)
+  if (entry && entry->value != NULL)
     base_uri = gconf_value_get_string (entry->value);
 
   if (base_uri == NULL || base_uri[0] == '\0') {
@@ -288,9 +288,9 @@ static void path_pattern_changed_cb (GCo
 {
   char *value;
   int i = 0;
-  g_return_if_fail (strcmp (entry->key, GCONF_PATH_PATTERN) == 0);
+  g_return_if_fail (!entry || strcmp (entry->key, GCONF_PATH_PATTERN) == 0);
 
-  if (entry->value == NULL) {
+  if (!entry || entry->value == NULL) {
     value = g_strdup (path_patterns[0].pattern);
   } else if (entry->value->type == GCONF_VALUE_STRING) {
     value = g_strdup (gconf_value_get_string (entry->value));
@@ -309,9 +309,9 @@ static void file_pattern_changed_cb (GCo
   char *value;
   int i = 0;
   
-  g_return_if_fail (strcmp (entry->key, GCONF_FILE_PATTERN) == 0);
+  g_return_if_fail (!entry || strcmp (entry->key, GCONF_FILE_PATTERN) == 0);
   
-  if (entry->value == NULL) {
+  if (!entry || entry->value == NULL) {
     value = g_strdup (file_patterns[0].pattern);
   } else if (entry->value->type == GCONF_VALUE_STRING) {
     value = g_strdup (gconf_value_get_string (entry->value));
@@ -330,9 +330,9 @@ static void file_pattern_changed_cb (GCo
  */
 static void device_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
 {
-  g_return_if_fail (strcmp (entry->key, GCONF_DEVICE) == 0);
+  g_return_if_fail (!entry || strcmp (entry->key, GCONF_DEVICE) == 0);
 
-  if (entry->value == NULL)
+  if (!entry || entry->value == NULL)
     return;
 
   if (entry->value->type == GCONF_VALUE_STRING) {
@@ -363,9 +363,9 @@ static void strip_changed_cb (GConfClien
   /* NOTE that strip_changed_cb in sj-main.c will also be called, and will also update
      the global value strip_chars - but which function will get called first?
      Make sure strip_chars is up to date BEFORE calling pattern_label_update */
-  g_return_if_fail (strcmp (entry->key, GCONF_STRIP) == 0);
+  g_return_if_fail (!entry || strcmp (entry->key, GCONF_STRIP) == 0);
 
-  if (entry->value == NULL) {
+  if (!entry || entry->value == NULL) {
     strip_chars = FALSE;
   } else {
     strip_chars = gconf_value_get_bool (entry->value);
