diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-06-21 06:03:15 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-06-21 06:03:15 +0000 |
commit | 73edf3f55bf19c2581e0c1346632ea5112b473a1 (patch) | |
tree | c6e3875f85120b3b232f6b14090a095fa26dcf38 /lib | |
parent | ffcba7b2ca8aee6eac47181bf138b6b96590abaa (diff) | |
download | ampache-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.php | 6 |
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; |