diff options
-rw-r--r-- | lib/Service/StreamService.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Service/StreamService.php b/lib/Service/StreamService.php index 52fd53ef..f619f132 100644 --- a/lib/Service/StreamService.php +++ b/lib/Service/StreamService.php @@ -355,7 +355,6 @@ class StreamService { * @param int $nid * * @return array - * @throws StreamNotFoundException */ public function getContextByNid(int $nid): array { $curr = $post = $this->streamRequest->getStreamByNid($nid); @@ -366,9 +365,13 @@ class StreamService { break; } - $curr = $this->streamRequest->getStreamById($curr->getInReplyTo()); - $curr->setExportFormat(ACore::FORMAT_LOCAL); - $ancestors[] = $curr; + try { + $curr = $this->streamRequest->getStreamById($curr->getInReplyTo(), true); + $curr->setExportFormat(ACore::FORMAT_LOCAL); + $ancestors[] = $curr; + } catch (StreamNotFoundException $e) { + break; // ancestor might be out of range for viewer + } } return [ |