From 925aacec1a09ade8acaaca2c604e33d17292fe40 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 26 May 2015 13:11:08 +0200 Subject: [PATCH] Throw exception when a Conversation is not found --- classes/Conversation.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/Conversation.php b/classes/Conversation.php index 343668cc49..537c214a4c 100644 --- a/classes/Conversation.php +++ b/classes/Conversation.php @@ -108,7 +108,13 @@ class Conversation extends Managed_DataObject static public function getUrlFromNotice(Notice $notice, $anchor=true) { - $conv = self::getKV('id', $notice->conversation); + $conv = new Conversation(); + $conv->id = $notice->conversation; + $conv->find(true); + if (!$conv instanceof Conversation) { + common_debug('Conversation does not exist for notice ID: '.$notice->id); + throw new NoResultException($conv); + } return $conv->getUrl($anchor ? $notice->id : null); } -- 2.39.5