From 5d61599964e74bb733816a5592eee2aed3bbba4e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 10 Apr 2021 16:19:22 +0000 Subject: [PATCH] Fix notices See https://github.com/friendica/friendica/issues/9749#issuecomment-774666356 and https://github.com/friendica/friendica/issues/9747#issuecomment-785262156 --- mod/display.php | 12 +++++++----- src/Module/Conversation/Community.php | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mod/display.php b/mod/display.php index 89dc340a4..2750102d7 100644 --- a/mod/display.php +++ b/mod/display.php @@ -188,12 +188,14 @@ function display_content(App $a, $update = false, $update_uid = 0) if ($update) { $uri_id = $_REQUEST['uri_id']; $item = Post::selectFirst(['uid', 'parent-uri-id'], ['uri-id' => $uri_id, 'uid' => $update_uid]); - if ($item['uid'] != 0) { - $a->profile = ['uid' => intval($item['uid'])]; - } else { - $a->profile = ['uid' => intval($update_uid)]; + if (!empty($item)) { + if ($item['uid'] != 0) { + $a->profile = ['uid' => intval($item['uid'])]; + } else { + $a->profile = ['uid' => intval($update_uid)]; + } + $parent_uri_id = $item['parent-uri-id']; } - $parent_uri_id = $item['parent-uri-id']; } else { $uri_id = (($a->argc > 2) ? $a->argv[2] : 0); $parent_uri_id = $uri_id; diff --git a/src/Module/Conversation/Community.php b/src/Module/Conversation/Community.php index 329f38e3b..18332fe27 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -359,6 +359,9 @@ class Community extends BaseModule $r = Post::selectThreadForUser(0, ['uri-id', 'commented', 'author-link'], $condition, $params); $items = Post::toArray($r); + if (empty($items)) { + return []; + } // Previous page case: once we get the relevant items closest to min_id, we need to restore the expected display order if (empty($item_id) && isset($min_id) && !isset($max_id)) {