diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-11-15 00:34:19 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-11-15 00:34:19 +0000 |
| commit | 685aeb5d7d5c0f5c2c33a5c951e51237611dd999 (patch) | |
| tree | ee7d8a947becff1828112b63395bbce0980e37e2 | |
| parent | 7b95e6091eae6d2d8aab6d5b66024f5b7cee7dbd (diff) | |
| download | rockbox-685aeb5d7d5c0f5c2c33a5c951e51237611dd999.zip rockbox-685aeb5d7d5c0f5c2c33a5c951e51237611dd999.tar.gz rockbox-685aeb5d7d5c0f5c2c33a5c951e51237611dd999.tar.bz2 rockbox-685aeb5d7d5c0f5c2c33a5c951e51237611dd999.tar.xz | |
Handle invalid playlist entries properly in new_file(). This fixes bug report #1060759
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5410 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/mpeg.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 2ad708d..e801f9c 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -839,7 +839,18 @@ static int add_track_to_tag_list(const char *filename) static int new_file(int steps) { int max_steps = playlist_amount(); - int start = num_tracks_in_memory() - 1; + int start = 0; + int i; + + /* Find out how many steps to advance. Each loaded tag has a "steps" member + that tells us how many playlist entries it had to skip to get to + a valid one. We add those together to find out where to start. */ + i = tag_read_idx; + while(i != tag_write_idx) + { + start += id3tags[i]->id3.index; + i = (i+1) & MAX_ID3_TAGS_MASK; + } if (start < 0) start = 0; |