summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-23 07:33:35 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-23 07:33:35 +0000
commit3625dedcce4a0ac81e74b0f0889ee741e7e2c0cf (patch)
treea4ecaa76abaea4aa7ce1ca2ee202ad74ecf4524b /apps/playlist.c
parente255798f444c2856558e80b2078595fb2054fa08 (diff)
downloadrockbox-3625dedcce4a0ac81e74b0f0889ee741e7e2c0cf.tar.gz
rockbox-3625dedcce4a0ac81e74b0f0889ee741e7e2c0cf.zip
playlist_next() now returns NULL on excessive 'step' amounts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 0ac848c59c..7e8ea36543 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -74,6 +74,10 @@ char* playlist_next(int steps, int* index)
74 char dir_buf[MAX_PATH+1]; 74 char dir_buf[MAX_PATH+1];
75 char *dir_end; 75 char *dir_end;
76 76
77 if(abs(steps) > playlist.amount)
78 /* prevent madness when all files are empty/bad */
79 return NULL;
80
77 playlist.index = (playlist.index+steps) % playlist.amount; 81 playlist.index = (playlist.index+steps) % playlist.amount;
78 while ( playlist.index < 0 ) { 82 while ( playlist.index < 0 ) {
79 if ( global_settings.loop_playlist ) 83 if ( global_settings.loop_playlist )