mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 09:05:58 +00:00
check if the method exists before jumping into the foreach loop. was causing problems in some situations
This commit is contained in:
parent
bbd2815316
commit
fc03f9f329
@ -31,7 +31,8 @@ class RSSWidget extends Widget {
|
||||
|
||||
function FeedItems() {
|
||||
$output = new DataObjectSet();
|
||||
foreach($this->feed->get_items(0, $this->NumberToShow) as $item) {
|
||||
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()
|
||||
@ -39,6 +40,7 @@ class RSSWidget extends Widget {
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user