]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Profile->getCurrentNotice handles PrivateStreamException
[quix0rs-gnu-social.git] / classes / Profile.php
index 84781d0f755e7a2f6ebfa648f57963ad473a909d..cd9b15961b9dd89b66f1a0b42a2b1b102d4eff47 100644 (file)
@@ -235,14 +235,20 @@ class Profile extends Managed_DataObject
      */
     function getCurrentNotice()
     {
-        $notice = $this->getNotices(0, 1);
+        try {
+            $notice = $this->getNotices(0, 1);
 
-        if ($notice->fetch()) {
-            if ($notice instanceof ArrayWrapper) {
-                // hack for things trying to work with single notices
-                return $notice->_items[0];
+            if ($notice->fetch()) {
+                if ($notice instanceof ArrayWrapper) {
+                    // hack for things trying to work with single notices
+                    // ...but this shouldn't happen anymore I think. Keeping it for safety...
+                    return $notice->_items[0];
+                }
+                return $notice;
             }
-            return $notice;
+        } catch (PrivateStreamException $e) {
+            // Maybe we should let this through if it's handled well upstream
+            return null;
         }
         
         return null;