From fc03f9f329ed8ecf11497d34b42a33f4cdf86122 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 11 Sep 2007 06:38:05 +0000 Subject: [PATCH] check if the method exists before jumping into the foreach loop. was causing problems in some situations --- code/RSSWidget.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/code/RSSWidget.php b/code/RSSWidget.php index c81f150..79bb2e8 100644 --- a/code/RSSWidget.php +++ b/code/RSSWidget.php @@ -31,13 +31,15 @@ class RSSWidget extends Widget { function FeedItems() { $output = new DataObjectSet(); - foreach($this->feed->get_items(0, $this->NumberToShow) as $item) { - $output->push(new ArrayData(array( - "Title" => $item->get_title(), - "Link" => $item->get_link() - ))); + if($items = $this->feed->get_items(0, $this->NumberToShow)) { + foreach($items as $item) { + $output->push(new ArrayData(array( + "Title" => $item->get_title(), + "Link" => $item->get_link() + ))); + } + return $output; } - return $output; } }