From: Evan Prodromou <evan@status.net>
Date: Sat, 5 May 2012 03:37:12 +0000 (-0400)
Subject: Hide stuff if there's an exception getting the profile
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=acf52a30413c19502f33c06436d74efa5a0334ed;p=quix0rs-gnu-social.git

Hide stuff if there's an exception getting the profile
---

diff --git a/classes/Notice.php b/classes/Notice.php
index 5b1bdcbdad..2c404e2550 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -2454,7 +2454,11 @@ class Notice extends Managed_DataObject
 
             if ($scope & Notice::FOLLOWER_SCOPE) {
 
-                $author = $this->getProfile();
+                try {
+                    $author = $this->getProfile();
+                } catch (Exception $e) {
+                    return false;
+                }
         
                 if (!Subscription::exists($profile, $author)) {
                     return false;
@@ -2471,7 +2475,13 @@ class Notice extends Managed_DataObject
 
         if (common_config('notice', 'hidespam')) {
 
-            $author = $this->getProfile();
+            try {
+                $author = $this->getProfile();
+            } catch(Exception $e) {
+                // If we can't get an author, keep it hidden.
+                // XXX: technically not spam, but, whatever.
+                return true;
+            }
 
             if ($author->hasRole(Profile_role::SILENCED)) {
                 if (empty($profile) || (($profile->id !== $author->id) && (!$profile->hasRight(Right::REVIEWSPAM)))) {