From 99845af35b7d64d0bf22602e732c8031e1e7c1e3 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 9 Nov 2014 21:28:49 +0100 Subject: [PATCH] Fixed inability to feature a post on empty db --- src/Services/PostFeatureService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Services/PostFeatureService.php b/src/Services/PostFeatureService.php index d48d5001..17486596 100644 --- a/src/Services/PostFeatureService.php +++ b/src/Services/PostFeatureService.php @@ -69,7 +69,7 @@ class PostFeatureService { $previousFeaturedPost = $this->getFeaturedPost(); - if ($previousFeaturedPost->getId() !== $post->getId()) + if (($previousFeaturedPost === null) or ($previousFeaturedPost->getId() !== $post->getId())) { $post->setLastFeatureTime($this->timeService->getCurrentTime()); $post->setFeatureCount($post->getFeatureCount() + 1);