Merge pull request 'Handle the admin user not having any entries in 'Feeds::_get_global_unread'.' (#60) from wn/tt-rss:bugfix/get-global-unread-admin-null into master

Reviewed-on: https://git.tt-rss.org/fox/tt-rss/pulls/60
This commit is contained in:
fox 2021-12-14 15:51:36 +03:00
commit 3ef9bb5b58
1 changed files with 4 additions and 2 deletions

View File

@ -955,7 +955,8 @@ class Feeds extends Handler_Protected {
$sth->execute([$owner_uid, $feed]);
$row = $sth->fetch();
return $row["count"];
// Handle 'SUM()' returning null if there are no results
return $row["count"] ?? 0;
} else if ($n_feed == -1) {
$match_part = "marked = true";
@ -1359,7 +1360,8 @@ class Feeds extends Handler_Protected {
$sth->execute([$user_id]);
$row = $sth->fetch();
return $row["count"];
// Handle 'SUM()' returning null if there are no articles/results (e.g. admin user with no feeds)
return $row["count"] ?? 0;
}
static function _get_cat_title(int $cat_id): string {