diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-17 20:32:52 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-17 20:32:52 +0200 |
commit | 2c2f8d98da0fc98ac4bfa4513021def5cdeaedb3 (patch) | |
tree | 67ac78c37999815c48b56bdaa1efba43c0f23f7e /index.php | |
parent | 07d82fc5f12ca39eb113896839426c6b64bf0869 (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.php | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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(); + } } } } |