summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-21 06:03:15 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-06-21 06:03:15 +0000
commit73edf3f55bf19c2581e0c1346632ea5112b473a1 (patch)
treec6e3875f85120b3b232f6b14090a095fa26dcf38 /lib
parentffcba7b2ca8aee6eac47181bf138b6b96590abaa (diff)
downloadampache-73edf3f55bf19c2581e0c1346632ea5112b473a1.tar.gz
ampache-73edf3f55bf19c2581e0c1346632ea5112b473a1.tar.bz2
ampache-73edf3f55bf19c2581e0c1346632ea5112b473a1.zip
syncing up < 8 > 0 album loop bug
Diffstat (limited to 'lib')
-rw-r--r--lib/album.lib.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/album.lib.php b/lib/album.lib.php
index ef0c7124..6edfc932 100644
--- a/lib/album.lib.php
+++ b/lib/album.lib.php
@@ -95,14 +95,16 @@ function get_random_albums($count='') {
$total = count($albums);
- if ($total == '0') { return array(); }
+ if ($total < ($count+2)) { return array(); }
for ($i=0; $i <= $count; $i++) {
+ $tries++;
$record = rand(0,$total);
- if (isset($results[$record]) || !$albums[$record]) { $i--; }
+ if (isset($results[$record]) || !$albums[$record]) { $i--; continue; }
else {
$results[$record] = $albums[$record];
}
+ if ($tries > 50) { return array(); }
} // end for
return $results;