From cb3c3434a10de179dbee84a870321f27c87f00e3 Mon Sep 17 00:00:00 2001 From: Vasiliy-Bondarenko Date: Sun, 11 May 2014 19:17:15 +0700 Subject: [PATCH] Fixed crash Article comments connector crashes if article is absent while comment still exist and need to be moderated. Crash happens when connector tries to create URL for not existing object and it just throws error. So i made a trick - returning JS alert in url. I think it's much better when just crash :) How to get error happen - delete resource from DB which has new comments and try to get comments for moderation in manager. connector will crash. --- core/components/quip/model/quip/quipcomment.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/components/quip/model/quip/quipcomment.class.php b/core/components/quip/model/quip/quipcomment.class.php index fe00b77..23ebf92 100644 --- a/core/components/quip/model/quip/quipcomment.class.php +++ b/core/components/quip/model/quip/quipcomment.class.php @@ -108,6 +108,7 @@ public function makeUrl($resource = 0,$params = array(),$options = array(),$addA $options['context_key'] = $this->get('context_key'); if (empty($options['context_key'])) { $modresource = $this->xpdo->getObject('modResource', $resource); + if (!$modresource) return "Javascript: alert('Commeted object is lost! You can delete this comment.')"; $options['context_key'] = $modresource->get('context_key'); } } @@ -512,4 +513,4 @@ public function prepare(array $properties = array(),$idx) { } return $commentArray; } -} \ No newline at end of file +}