From c3110ec8ace2ee6b9fdb3c0995c9ad465ba00a14 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 26 Nov 2009 18:54:52 +1300 Subject: [PATCH] check there is an array of notices to display, before doing a foreach() --- lib/rssaction.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/rssaction.php b/lib/rssaction.php index 3b303f73ea..d591c99ed8 100644 --- a/lib/rssaction.php +++ b/lib/rssaction.php @@ -176,8 +176,10 @@ class Rss10Action extends Action $this->showChannel(); $this->showImage(); - foreach ($this->notices as $n) { - $this->showItem($n); + if (count($this->notices)) { + foreach ($this->notices as $n) { + $this->showItem($n); + } } $this->showCreators(); @@ -203,8 +205,10 @@ class Rss10Action extends Action $this->elementStart('items'); $this->elementStart('rdf:Seq'); - foreach ($this->notices as $notice) { - $this->element('rdf:li', array('rdf:resource' => $notice->uri)); + if (count($this->notices)) { + foreach ($this->notices as $notice) { + $this->element('rdf:li', array('rdf:resource' => $notice->uri)); + } } $this->elementEnd('rdf:Seq');