From: Evan Prodromou Date: Fri, 24 May 2013 13:26:58 +0000 (-0400) Subject: Throw an exception converting fave to activity for non-existent notice or profile X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ea8151688e1ce14d115b9b733156fc5474e71b8f;p=quix0rs-gnu-social.git Throw an exception converting fave to activity for non-existent notice or profile --- diff --git a/classes/Fave.php b/classes/Fave.php index 59a1e00318..455e7b089c 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -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;