[rhythmbox] metadata: don't crash if there are no saveable types (bug #590108)



commit 47a5f4753d1cfcd2bcc2de10daeaa7a71f598d5d
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Jul 29 20:36:48 2009 +1000

    metadata: don't crash if there are no saveable types (bug #590108)

 metadata/rb-metadata-dbus-client.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/metadata/rb-metadata-dbus-client.c b/metadata/rb-metadata-dbus-client.c
index 8683446..30e1760 100644
--- a/metadata/rb-metadata-dbus-client.c
+++ b/metadata/rb-metadata-dbus-client.c
@@ -349,9 +349,13 @@ start_metadata_service (GError **error)
 		return FALSE;
 	}
 
-	saveable_type_list = g_strjoinv (", ", saveable_types);
-	rb_debug ("saveable types from metadata helper: %s", saveable_type_list);
-	g_free (saveable_type_list);
+	if (saveable_types != NULL) {
+		saveable_type_list = g_strjoinv (", ", saveable_types);
+		rb_debug ("saveable types from metadata helper: %s", saveable_type_list);
+		g_free (saveable_type_list);
+	} else {
+		rb_debug ("unable to save metadata for any file types");
+	}
 
 	if (message)
 		dbus_message_unref (message);
@@ -704,10 +708,12 @@ rb_metadata_can_save (RBMetaData *md, const char *mimetype)
 		}
 	}
 
-	for (i = 0; saveable_types[i] != NULL; i++) {
-		if (g_str_equal (mimetype, saveable_types[i])) {
-			result = TRUE;
-			break;
+	if (saveable_types != NULL) {
+		for (i = 0; saveable_types[i] != NULL; i++) {
+			if (g_str_equal (mimetype, saveable_types[i])) {
+				result = TRUE;
+				break;
+			}
 		}
 	}
 



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