Fixed E_NOTICE when no valid result has been returned. (#5457)
This commit is contained in:
parent
7876d6547b
commit
ad857b4314
|
@ -68,7 +68,10 @@ function notes_content(App $a, $update = false)
|
||||||
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
||||||
$r = Item::selectForUser(local_user(), ['id'], $condition, $params);
|
$r = Item::selectForUser(local_user(), ['id'], $condition, $params);
|
||||||
|
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
|
$count = count($r);
|
||||||
$parents_arr = [];
|
$parents_arr = [];
|
||||||
|
|
||||||
while ($rr = Item::fetch($r)) {
|
while ($rr = Item::fetch($r)) {
|
||||||
|
@ -78,12 +81,14 @@ function notes_content(App $a, $update = false)
|
||||||
|
|
||||||
$condition = ['uid' => local_user(), 'parent' => $parents_arr];
|
$condition = ['uid' => local_user(), 'parent' => $parents_arr];
|
||||||
$result = Item::selectForUser(local_user(), [], $condition);
|
$result = Item::selectForUser(local_user(), [], $condition);
|
||||||
|
|
||||||
if (DBM::is_result($result)) {
|
if (DBM::is_result($result)) {
|
||||||
$items = conv_sort(Item::inArray($result), 'commented');
|
$items = conv_sort(Item::inArray($result), 'commented');
|
||||||
$o .= conversation($a, $items, 'notes', $update);
|
$o .= conversation($a, $items, 'notes', $update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= alt_pager($a, count($r));
|
$o .= alt_pager($a, $count);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue