X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FNotice.php;h=ebbd9e0462b7e64cb416c1a1eda7c8fd8076885c;hb=f29daa22b6a7319632b2c3798313f54a6b762a10;hp=1b6edb4cd34e659f7bc715d7443ad968741a85d3;hpb=c950f1854623f0df2a50c193f624f0a0bf1fcbb3;p=quix0rs-gnu-social.git diff --git a/classes/Notice.php b/classes/Notice.php index 1b6edb4cd3..ebbd9e0462 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -2775,10 +2775,24 @@ class Notice extends Managed_DataObject public function getParent() { + $reply_to_id = null; + if (empty($this->reply_to)) { throw new NoParentNoticeException($this); } - return self::getByID($this->reply_to); + + // The reply_to ID in the table Notice could exist with a number + // however, the replied to notice might not exist in the database. + // Thus we need to catch the exception and throw the NoParentNoticeException else + // the timeline will not display correctly. + try { + $reply_to_id = self::getByID($this->reply_to); + } catch(Exception $e){ + throw new NoParentNoticeException($this); + } + + + return $reply_to_id; } /**