Throw an exception converting fave to activity for non-existent notice or profile

This commit is contained in:
Evan Prodromou 2013-05-24 09:26:58 -04:00
parent d7880c17ec
commit ea8151688e
1 changed files with 10 additions and 1 deletions

View 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;