From 10ad0a2a942f0dc2a31374135440c25a1a4f05bb Mon Sep 17 00:00:00 2001 From: Hardeep Sidhu Date: Mon, 18 Sep 2006 20:47:27 +0000 Subject: Fixed problem with first_index being incorrectly updated when prepending tracks. Fixes example 1 in B#6005. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10996 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index 4ab98ab3c6..6648d4462e 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -571,10 +571,12 @@ static int add_track_to_playlist(struct playlist_info* playlist, const char *filename, int position, bool queue, int seek_pos) { - int insert_position = position; + int insert_position, orig_position; unsigned long flags = PLAYLIST_INSERT_TYPE_INSERT; int i; + insert_position = orig_position = position; + if (playlist->amount >= playlist->max_playlist_size) { display_buffer_full(); @@ -661,7 +663,7 @@ static int add_track_to_playlist(struct playlist_info* playlist, playlist->index++; if (playlist->amount > 0 && insert_position <= playlist->first_index && - position != PLAYLIST_PREPEND && playlist->started) + orig_position != PLAYLIST_PREPEND && playlist->started) { playlist->first_index++; -- cgit v1.2.3