From 5278de99666c50262aab31d90b3d01245f59bb45 Mon Sep 17 00:00:00 2001 From: jdgordon Date: Sun, 29 Jun 2008 02:19:53 +0000 Subject: [PATCH] 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 --- apps/playlist.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/playlist.c b/apps/playlist.c index 280d6dc19..8f800f616 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) if (fd >= 0) { read(fd,&folder_count,sizeof(int)); + if (!folder_count) + exit = true; while (!exit) { i = rand()%folder_count; @@ -1494,7 +1496,8 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion) if (check_subdir_for_music(buffer,"") ==0) exit = true; } - strcpy(dir,buffer); + if (folder_count) + strcpy(dir,buffer); close(fd); *(tc->dirfilter) = dirfilter; reload_directory(); -- 2.11.4.GIT