diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-09 13:47:38 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-10-09 13:47:38 +0000 |
commit | 56e5d1a0a1f87f24635207f70c42b5efc3fe35ab (patch) | |
tree | e7df868b37964d6efc62dcafdcd35b7ddd38143b /firmware | |
parent | d035a9b0bc2e34ada1687a110fda75485938cf23 (diff) |
Better handling of bad playlists, and when all tracks fit in memory
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2550 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/mpeg.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 104b6c5011..f149814dac 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -57,6 +57,7 @@ extern void bitswap(unsigned char *data, int length); extern char* playlist_peek(int steps); extern int playlist_next(int steps); +extern int playlist_amount(void); extern void update_file_pos( int id, int pos ); static char *units[] = @@ -709,6 +710,7 @@ static int add_track_to_tag_list(char *filename) /* If next_track is true, opens the next track, if false, opens prev track */ static int new_file(int steps) { + int max_steps = playlist_amount(); int start = num_tracks_in_memory() - 1; if (start < 0) @@ -727,6 +729,10 @@ static int new_file(int steps) if(mpeg_file < 0) { DEBUGF("Couldn't open file: %s\n",trackname); steps++; + + /* Bail out if no file could be opened */ + if(steps > max_steps) + return -1; } else { |