Error when feed does not exist

https://github.com/marienfressinaud/FreshRSS/issues/579
This commit is contained in:
Alexandre Alapetite
2014-08-19 21:39:45 +02:00
parent 50075bfbdc
commit 0d0b8cd39b
2 changed files with 12 additions and 1 deletions

View File

@@ -28,6 +28,12 @@ class FreshRSS_Feed extends Minz_Model {
}
}
public static function example() {
$f = new FreshRSS_Feed('http://example.net/', false);
$f->faviconPrepare();
return $f;
}
public function id() {
return $this->id;
}

View File

@@ -81,7 +81,12 @@ if (!empty($this->entries)) {
}
}
$feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed ()); //We most likely already have the feed object in cache
if (empty($feed)) $feed = $item->feed (true);
if ($feed == null) {
$feed = $item->feed(true);
if ($feed == null) {
$feed = FreshRSS_Feed::example();
}
}
?><li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="✇" /> <span><?php echo $feed->name(); ?></span></a></li>
<li class="item title"><a target="_blank" href="<?php echo $item->link (); ?>"><?php echo $item->title (); ?></a></li>
<?php if ($topline_date) { ?><li class="item date"><?php echo $item->date (); ?> </li><?php } ?>