summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-06-29 02:19:53 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-06-29 02:19:53 +0000
commit8f3175b77909206d2764295a9160882ce943575f (patch)
tree81d7373edbe7a94b68de2772c085d6ef253d6a0c /apps/playlist.c
parent475c2e7d0518152c00fed75de40b83a66abdcbed (diff)
downloadrockbox-8f3175b77909206d2764295a9160882ce943575f.tar.gz
rockbox-8f3175b77909206d2764295a9160882ce943575f.zip
fix FS#9119 (crash if random folder list has no entries)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17862 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 280d6dc19f..8f800f616b 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1486,6 +1486,8 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1486 if (fd >= 0) 1486 if (fd >= 0)
1487 { 1487 {
1488 read(fd,&folder_count,sizeof(int)); 1488 read(fd,&folder_count,sizeof(int));
1489 if (!folder_count)
1490 exit = true;
1489 while (!exit) 1491 while (!exit)
1490 { 1492 {
1491 i = rand()%folder_count; 1493 i = rand()%folder_count;
@@ -1494,7 +1496,8 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion)
1494 if (check_subdir_for_music(buffer,"") ==0) 1496 if (check_subdir_for_music(buffer,"") ==0)
1495 exit = true; 1497 exit = true;
1496 } 1498 }
1497 strcpy(dir,buffer); 1499 if (folder_count)
1500 strcpy(dir,buffer);
1498 close(fd); 1501 close(fd);
1499 *(tc->dirfilter) = dirfilter; 1502 *(tc->dirfilter) = dirfilter;
1500 reload_directory(); 1503 reload_directory();