git.cweiske.de
/
stouyapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
e6594fe
)
Do not crash when only few games exist
author
Christian Weiske
<cweiske@cweiske.de>
Tue, 9 Jun 2020 18:57:47 +0000
(20:57 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 9 Jun 2020 18:57:47 +0000
(20:57 +0200)
bin/filters.php
patch
|
blob
|
history
diff --git
a/bin/filters.php
b/bin/filters.php
index a10777a03ed65bcec36ed507da65c6dc93a30e2b..107714d7ca5d5afbfe73354771225aea4b12f3e3 100644
(file)
--- a/
bin/filters.php
+++ b/
bin/filters.php
@@
-117,7
+117,7
@@
function filterMostDownloaded($origGames, $limit)
function filterRandom($origGames, $limit)
{
- $randKeys = array_rand($origGames,
$limit
);
+ $randKeys = array_rand($origGames,
min(count($origGames), $limit)
);
$games = [];
foreach ($randKeys as $key) {
$games[] = $origGames[$key];