From 07b0d18fa76b419b9bc93f9cbd440a149d5439ff Mon Sep 17 00:00:00 2001 From: Matt Peel Date: Fri, 26 Oct 2007 05:28:05 +0000 Subject: [PATCH] Trac #1556: Added if() check around a foreach loop that was causing errors when there were no entries in an RSS feed. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@43890 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- api/RSSFeed.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/RSSFeed.php b/api/RSSFeed.php index 29fd99c15..791e30bd8 100755 --- a/api/RSSFeed.php +++ b/api/RSSFeed.php @@ -129,8 +129,10 @@ class RSSFeed extends ViewableData { */ function Entries() { $output = new DataObjectSet(); - foreach($this->entries as $entry) { - $output->push(new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField)); + if(isset($this->entries)) { + foreach($this->entries as $entry) { + $output->push(new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField)); + } } return $output; }