check if the method exists before jumping into the foreach loop. was causing problems in some situations

This commit is contained in:
Sean Harvey 2007-09-11 06:38:05 +00:00
parent bbd2815316
commit fc03f9f329

View File

@ -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;
}
}