From 2252a9ffafc92bb2f9d77b65fdd832e5f377e43d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 8 Jun 2013 14:56:57 -0400 Subject: [PATCH] Throw exception if subscription is invalid --- classes/Subscription.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/Subscription.php b/classes/Subscription.php index f40239989c..70ccd724be 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -67,7 +67,7 @@ class Subscription extends Managed_DataObject 'subscription_token_idx' => array('token'), ), ); - } + } /* Static get */ function staticGet($k,$v=null) @@ -262,6 +262,14 @@ class Subscription extends Managed_DataObject $subscriber = Profile::staticGet('id', $this->subscriber); $subscribed = Profile::staticGet('id', $this->subscribed); + if (empty($subscriber)) { + throw new Exception(sprintf(_('No profile for the subscriber: %d'), $this->subscriber)); + } + + if (empty($subscribed)) { + throw new Exception(sprintf(_('No profile for the subscribed: %d'), $this->subscribed)); + } + $act = new Activity(); $act->verb = ActivityVerb::FOLLOW;