[rhythmbox] generic-player: fix crash when trying to delete with no audio folders



commit a992081242f2639a5343fe7609da0f43d1a804d0
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Jun 20 12:25:07 2009 +1000

    generic-player: fix crash when trying to delete with no audio folders

 plugins/generic-player/rb-generic-player-source.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/plugins/generic-player/rb-generic-player-source.c b/plugins/generic-player/rb-generic-player-source.c
index 959cb3d..adcfd84 100644
--- a/plugins/generic-player/rb-generic-player-source.c
+++ b/plugins/generic-player/rb-generic-player-source.c
@@ -1211,15 +1211,17 @@ can_delete_directory (RBSource *source, GFile *dir)
 
 	/* can't delete the device's audio folders */
 	result = TRUE;
-	for (i = 0; priv->audio_folders[i] != NULL; i++) {
-		GFile *check;
+	if (priv->audio_folders != NULL) {
+		for (i = 0; priv->audio_folders[i] != NULL; i++) {
+			GFile *check;
 
-		check = g_file_resolve_relative_path (root, priv->audio_folders[i]);
-		if (g_file_equal (dir, check)) {
-			rb_debug ("refusing to delete device audio folder %s", priv->audio_folders[i]);
-			result = FALSE;
+			check = g_file_resolve_relative_path (root, priv->audio_folders[i]);
+			if (g_file_equal (dir, check)) {
+				rb_debug ("refusing to delete device audio folder %s", priv->audio_folders[i]);
+				result = FALSE;
+			}
+			g_object_unref (check);
 		}
-		g_object_unref (check);
 	}
 
 	/* can delete anything else */



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