From 3cfcaece5c20f39abc70f0e24c8465fb96bc292d Mon Sep 17 00:00:00 2001 From: Johannes Hammersen Date: Thu, 22 Dec 2016 11:05:02 +0100 Subject: [PATCH] Fix: setting error fails if record does not exist StaticPagesQueue::has_error loads object by url. If the object does not exist (any longer) the code will fail crashing the BuildQue. Added check to ensure a record was found, otherwise there is no point in setting the error. --- code/model/StaticPagesQueue.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/model/StaticPagesQueue.php b/code/model/StaticPagesQueue.php index 4bc0fdeb..bac6acd0 100644 --- a/code/model/StaticPagesQueue.php +++ b/code/model/StaticPagesQueue.php @@ -146,6 +146,8 @@ public static function has_error( $url ) { if(!$url) return; $existingObject = self::get_by_link($url); + if(!$existingObject) return; + $existingObject->Freshness = 'error'; $existingObject->write(); }