]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Throw an exception converting fave to activity for non-existent notice or profile
authorEvan Prodromou <evan@e14n.com>
Fri, 24 May 2013 13:26:58 +0000 (09:26 -0400)
committerEvan Prodromou <evan@e14n.com>
Fri, 24 May 2013 13:27:21 +0000 (09:27 -0400)
classes/Fave.php

index 59a1e00318c2dfe8cf94ee15c5123fde0dd1f0b5..455e7b089cee57f44ede339cbe8ecab8f5127564 100644 (file)
@@ -124,9 +124,18 @@ class Fave extends Managed_DataObject
 
     function asActivity()
     {
-        $notice  = Notice::staticGet('id', $this->notice_id);
+        $notice = Notice::staticGet('id', $this->notice_id);
+
+        if (!$notice) {
+            throw new Exception("Fave for non-existent notice: " . $this->notice_id);
+        }
+
         $profile = Profile::staticGet('id', $this->user_id);
 
+        if (!$profile) {
+            throw new Exception("Fave by non-existent profile: " . $this->user_id);
+        }
+
         $act = new Activity();
 
         $act->verb = ActivityVerb::FAVORITE;