Fix erroneous unread count in some specific cases.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 8 May 2011 16:53:39 +0000 (18:53 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 8 May 2011 16:53:39 +0000 (18:53 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
banana/nntp.inc.php

index a880dd0..910075d 100644 (file)
@@ -89,7 +89,12 @@ class BananaNNTP extends BananaNNTPCore implements BananaProtocoleInterface
             foreach ($this->boxes as $group=>&$desc) {
                 list($msgnum, $first, $last, $groupname) = $this->group($group);
                 $this->ingroup = $group;
-                $new = count($this->newnews($group, $since));
+                $new = $this->newnews($group, $since);
+                if (!is_array($new)) {
+                    $new = 0;
+                } else {
+                    $new = count($new);
+                }
                 $desc['msgnum'] = $msgnum;
                 $desc['unread'] = $new;
             }