--- old-trash/sources/rb-ipod-source.c	2006-12-01 17:02:51.000000000 +1000
+++ new-trash/sources/rb-ipod-source.c	2006-12-01 17:02:51.000000000 +1000
@@ -126,9 +126,17 @@
 	Itdb_Playlist *mpl;
 	RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
 
+	if (name == NULL)
+		return;
+
 	mpl = itdb_playlist_mpl (priv->ipod_db);
+	if (mpl == NULL) {
+		rb_debug ("Couldn't find iPod's master playlist");
+		return;
+	}
+
 	rb_debug ("Renaming iPod from %s to %s", mpl->name, name);
-	if (strcmp (mpl->name, name) == 0) {
+	if ((mpl->name != NULL) && (strcmp (mpl->name, name) == 0)) {
 		rb_debug ("iPod is already named %s", name);
 		return;
 	}
@@ -311,6 +319,9 @@
 		Itdb_Playlist *playlist;
 
 		playlist = (Itdb_Playlist *)it->data;
+		if (playlist == NULL) {
+			continue;
+		}
 		if (itdb_playlist_is_mpl (playlist)) {
 			continue;
 		}
@@ -563,9 +574,14 @@
 		/* FIXME: we could set a different icon depending on the iPod
 		 * model
 		 */
-		g_object_set (RB_SOURCE (source),
-			      "name", itdb_playlist_mpl (priv->ipod_db)->name,
-			      NULL);
+		Itdb_Playlist *mpl;
+		mpl = itdb_playlist_mpl (priv->ipod_db);
+
+		if (mpl != NULL) {
+			g_object_set (RB_SOURCE (source),
+				      "name", mpl->name,
+				      NULL);
+		}
 		priv->load_idle_id = g_idle_add ((GSourceFunc)load_ipod_db_idle_cb, source);
 	}
 
@@ -917,20 +933,21 @@
 {
 	RhythmDB *db;
 	Itdb_Track *song;
+	Itdb_Playlist *mpl;
+	RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
 
         db = get_db_for_source (source);
 
+	mpl = itdb_playlist_mpl (priv->ipod_db);
 	song = create_ipod_song_from_entry (entry);
-	if (song != NULL) {
-		RBiPodSourcePrivate *priv = IPOD_SOURCE_GET_PRIVATE (source);
+	if (mpl != NULL && song != NULL) {
 		char *filename;
 
 		filename = g_filename_from_uri (dest, NULL, NULL);
 		song->ipod_path = ipod_path_from_unix_path (priv->ipod_mount_path, filename);
 		g_free (filename);
 		itdb_track_add (priv->ipod_db, song, -1);
-		itdb_playlist_add_track (itdb_playlist_mpl (priv->ipod_db),
-					 song, -1);
+		itdb_playlist_add_track (mpl, song, -1);
 
 		add_ipod_song_to_db (source, db, song);
 		itdb_schedule_save (priv->ipod_db);

