diff --git a/classes/feeds.php b/classes/feeds.php index a9afb70f2..62fd6a5b3 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -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 {