From 7287030317ae7045440df94e557e25a4bc6f9890 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 9 Jun 2020 20:57:47 +0200 Subject: [PATCH] Do not crash when only few games exist --- bin/filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/filters.php b/bin/filters.php index a10777a..107714d 100644 --- 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]; -- 2.30.2