From: Mikael Nordfeldth Date: Mon, 4 Jan 2016 20:38:41 +0000 (+0100) Subject: Profile->getCurrentNotice handles PrivateStreamException X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6a169398308889c7a0e0e253db91c25a893c6950;p=quix0rs-gnu-social.git Profile->getCurrentNotice handles PrivateStreamException --- diff --git a/classes/Profile.php b/classes/Profile.php index 84781d0f75..cd9b15961b 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -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;