Index: shell/rb-history.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-history.c,v
retrieving revision 1.13
diff -u -r1.13 rb-history.c
--- shell/rb-history.c	14 Jul 2006 12:30:49 -0000	1.13
+++ shell/rb-history.c	3 Nov 2006 00:30:45 -0000
@@ -373,12 +373,18 @@
 void
 rb_history_append (RBHistory *hist, RhythmDBEntry *entry)
 {
-	GSequencePtr new_node;
+	GSequencePtr new_node, last;
 
 	g_return_if_fail (RB_IS_HISTORY (hist));
 	g_return_if_fail (entry != NULL);
 
-	rb_history_remove_entry (hist, entry);
+	if (entry == g_sequence_ptr_get_data(hist->priv->current)) {
+		rb_history_remove_entry (hist, entry);
+		last = g_sequence_ptr_prev (g_sequence_get_end_ptr (hist->priv->seq));
+		hist->priv->current = last ? last : g_sequence_get_end_ptr (hist->priv->seq);
+	} else {
+		rb_history_remove_entry (hist, entry);
+	}
 
 	g_sequence_append (hist->priv->seq, entry);
 	new_node = g_sequence_ptr_prev (g_sequence_get_end_ptr (hist->priv->seq));
Index: shell/rb-play-order-random.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-play-order-random.c,v
retrieving revision 1.14
diff -u -r1.14 rb-play-order-random.c
--- shell/rb-play-order-random.c	6 Aug 2006 10:04:47 -0000	1.14
+++ shell/rb-play-order-random.c	3 Nov 2006 00:30:45 -0000
@@ -351,16 +351,11 @@
 	if (entry)
 		rhythmdb_entry_unref (entry);
 
-	g_object_get (rorder, "playing-entry", &entry, NULL);
-	g_assert (entry == NULL || rb_history_current (history) == NULL || entry == rb_history_current (history));
 	if (rb_history_current (history) == NULL)
 		rb_history_go_first (history);
 	else
 		rb_history_go_next (history);
 	rb_play_order_set_playing_entry (porder, rb_history_current (history));
-
-	if (entry)
-		rhythmdb_entry_unref (entry);
 }
 
 static RhythmDBEntry*
