[rhythmbox] audiocd: check that cdda:// URIs include the device path (bug #600494)



commit b0bfd801896c02b269c3efb8382bd8cfed5f6ade
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Mar 13 20:48:37 2010 +1000

    audiocd: check that cdda:// URIs include the device path (bug #600494)
    
    Audio CD URIs are supposed to include the device path as the URI fragment.
    We previously didn't check that it the URI fragment was actually there,
    so we crashed on manually entered cdda:// URIs with no device path.

 plugins/audiocd/rb-audiocd-plugin.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/plugins/audiocd/rb-audiocd-plugin.c b/plugins/audiocd/rb-audiocd-plugin.c
index 4bb9fe8..d954c58 100644
--- a/plugins/audiocd/rb-audiocd-plugin.c
+++ b/plugins/audiocd/rb-audiocd-plugin.c
@@ -194,7 +194,7 @@ rb_audiocd_plugin_can_reuse_stream_cb (RBPlayer *player,
 	/* check the device matches */
 	new_device = g_utf8_strrchr (new_uri, -1, '#');
 	old_device = g_utf8_strrchr (stream_uri, -1, '#');
-	if (strcmp (old_device, new_device) != 0) {
+	if (new_device == NULL || old_device == NULL || strcmp (old_device, new_device) != 0) {
 		return FALSE;
 	}
 
@@ -217,6 +217,7 @@ rb_audiocd_plugin_reuse_stream_cb (RBPlayer *player,
 	/* get the new track number */
 	cdda_len = strlen ("cdda://");
 	new_device = g_utf8_strrchr (new_uri, -1, '#');
+	g_assert (new_device != NULL);
 	track_str = g_strndup (new_uri + cdda_len, new_device - (new_uri + cdda_len));
 	track = atoi (track_str);
 	g_free (track_str);



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