summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2012-08-17 20:32:52 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2012-08-17 20:32:52 +0200
commit2c2f8d98da0fc98ac4bfa4513021def5cdeaedb3 (patch)
tree67ac78c37999815c48b56bdaa1efba43c0f23f7e /index.php
parent07d82fc5f12ca39eb113896839426c6b64bf0869 (diff)
fixed a bug that would cause the app to crash if the previously feed is deleted from the database
Diffstat (limited to 'index.php')
-rw-r--r--index.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/index.php b/index.php
index c1ead8434..af7cc9a3f 100644
--- a/index.php
+++ b/index.php
@@ -35,11 +35,15 @@ $folderforest = $foldermapper->childrenOf(0); //retrieve all the folders
if ($allfeeds) {
$feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null;
if ($feedid == null) {
+ $feedmapper = new OCA\News\FeedMapper(OCP\USER::getUser($userid));
if(OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'lastViewedFeed') == null){
- $feedmapper = new OCA\News\FeedMapper(OCP\USER::getUser($userid));
- $feedid = $feedmapper->mostRecent();
+ $feedid = $feedmapper->mostRecent();
} else {
$feedid = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'lastViewedFeed');
+ // check if feed exists in table
+ if($feedmapper->findById($feedid) === null){
+ $feedid = $feedmapper->mostRecent();
+ }
}
}
}