summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2008-01-03 07:29:19 +0000
committerSteve Bavin <pondlife@pondlife.me>2008-01-03 07:29:19 +0000
commitc7a046dd1dd4d1d1bde2f1e83a68073b54088384 (patch)
tree6d5325a0d23b354310a4d7d48e1d42f1379d8c45
parent21abf6579fbfa1f46ccb7dc0857b76e8574a7ce5 (diff)
downloadrockbox-c7a046dd1dd4d1d1bde2f1e83a68073b54088384.tar.gz
rockbox-c7a046dd1dd4d1d1bde2f1e83a68073b54088384.tar.bz2
rockbox-c7a046dd1dd4d1d1bde2f1e83a68073b54088384.zip
FS#8375 - Fix division by zero using the random database selection in a near-empty subset. Thanks to Henri Valta.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15989 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/tagtree.c2
-rw-r--r--docs/CREDITS1
2 files changed, 3 insertions, 0 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c
index d394491960..0163ddbb2f 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1385,6 +1385,8 @@ int tagtree_enter(struct tree_context* c)
seek = dptr->extraseek;
if (seek == -1)
{
+ if(c->filesindir<=2)
+ return 0;
srand(current_tick);
dptr = (tagtree_get_entry(c, 2+(rand() % (c->filesindir-2))));
seek = dptr->extraseek;
diff --git a/docs/CREDITS b/docs/CREDITS
index 91f841c214..f9dee10c3f 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -357,6 +357,7 @@ Jonas Hurrelmann
Lee Kang Hyuk
Clemens Werther
Robert Menes
+Henri Valta
The libmad team
The wavpack team