Fixed empty $row['pm_count'] (#880)

This commit is contained in:
Roman Kelesidis 2023-09-02 11:28:29 +07:00 committed by GitHub
commit bebf6dd4a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,7 +78,7 @@ if ($logged_in && empty($gen_simple_header) && !defined('IN_ADMIN')) {
}
}
if (!$have_new_pm && $userdata['user_unread_privmsg']) {
// synch unread pm count
// sync unread pm count
if (defined('IN_PM')) {
$row = DB()->fetch_row("
SELECT COUNT(*) AS pm_count
@ -88,7 +88,7 @@ if ($logged_in && empty($gen_simple_header) && !defined('IN_ADMIN')) {
GROUP BY privmsgs_to_userid
");
$real_unread_pm_count = (int)$row['pm_count'];
$real_unread_pm_count = (int)$row['pm_count'] ?? 0;
if ($userdata['user_unread_privmsg'] != $real_unread_pm_count) {
$userdata['user_unread_privmsg'] = $real_unread_pm_count;