From ad857b43149624998c09f9acc25e61c716041951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Mon, 23 Jul 2018 00:05:10 +0200 Subject: [PATCH] Fixed E_NOTICE when no valid result has been returned. (#5457) --- mod/notes.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/notes.php b/mod/notes.php index f83195ff1c..3bc9e0fade 100644 --- a/mod/notes.php +++ b/mod/notes.php @@ -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; }