]> git.mxchange.org Git - friendica.git/blobdiff - mod/notes.php
Fixed E_NOTICE when no valid result has been returned. (#5457)
[friendica.git] / mod / notes.php
index f83195ff1ccdb1e1a16f75375d8df20bd1b27ad9..3bc9e0fadebbd1c16bc98a32dcb4147d9711f777 100644 (file)
@@ -68,7 +68,10 @@ function notes_content(App $a, $update = false)
                'limit' => [$a->pager['start'], $a->pager['itemspage']]];
        $r = Item::selectForUser(local_user(), ['id'], $condition, $params);
 
+       $count = 0;
+
        if (DBM::is_result($r)) {
+               $count = count($r);
                $parents_arr = [];
 
                while ($rr = Item::fetch($r)) {
@@ -78,12 +81,14 @@ function notes_content(App $a, $update = false)
 
                $condition = ['uid' => local_user(), 'parent' => $parents_arr];
                $result = Item::selectForUser(local_user(), [], $condition);
+
                if (DBM::is_result($result)) {
                        $items = conv_sort(Item::inArray($result), 'commented');
                        $o .= conversation($a, $items, 'notes', $update);
                }
        }
 
-       $o .= alt_pager($a, count($r));
+       $o .= alt_pager($a, $count);
+
        return $o;
 }