]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
geParent() method will fail if the parent notice does not exist in the notice table...
authorabjectio <abjectio@kollektivet0x242.no>
Wed, 14 Oct 2015 16:50:39 +0000 (18:50 +0200)
committerabjectio <abjectio@kollektivet0x242.no>
Wed, 14 Oct 2015 16:50:39 +0000 (18:50 +0200)
classes/Notice.php

index 1b6edb4cd34e659f7bc715d7443ad968741a85d3..78ee18a980faf8e9ed8827a74de4f6efed2c70c7 100644 (file)
@@ -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;
     }
 
     /**