summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornodivbyzero <nodivbyzero@gmail.com>2018-03-20 21:47:44 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2018-03-21 07:45:26 +0100
commiteccd328d428cbe1445118d24b1bf789c5b3b83c9 (patch)
treeb92e2430a12a9862a0d7cd9263386bdc5ef29694
parent3d90623154eeae9864e6d659d3d46f9774abb458 (diff)
downloadaur-eccd328d428cbe1445118d24b1bf789c5b3b83c9.tar.gz
aur-eccd328d428cbe1445118d24b1bf789c5b3b83c9.tar.xz
Handle empty resultset getting recent 10 packages
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
-rw-r--r--web/lib/stats.inc.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/web/lib/stats.inc.php b/web/lib/stats.inc.php
index 80619fe1..f5692f96 100644
--- a/web/lib/stats.inc.php
+++ b/web/lib/stats.inc.php
@@ -19,10 +19,12 @@ function updates_table() {
$result = $dbh->query($q);
$newest_packages = new ArrayObject();
- while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
- $newest_packages->append($row);
+ if ($result) {
+ while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
+ $newest_packages->append($row);
+ }
+ set_cache_value($key, $newest_packages);
}
- set_cache_value($key, $newest_packages);
}
include('stats/updates_table.php');
}