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
This commit is contained in:
Matt Peel 2007-10-26 05:28:05 +00:00
parent c186b13172
commit 07b0d18fa7

View File

@ -129,9 +129,11 @@ class RSSFeed extends ViewableData {
*/ */
function Entries() { function Entries() {
$output = new DataObjectSet(); $output = new DataObjectSet();
if(isset($this->entries)) {
foreach($this->entries as $entry) { foreach($this->entries as $entry) {
$output->push(new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField)); $output->push(new RSSFeed_Entry($entry, $this->titleField, $this->descriptionField, $this->authorField));
} }
}
return $output; return $output;
} }