Browse Source

Fixes possible crash in the RSS Downloader dialog (when having RSS folders)

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
c3322cdc91
  1. 12
      src/rss/automatedrssdownloader.cpp
  2. 4
      src/rss/rssfolder.cpp

12
src/rss/automatedrssdownloader.cpp

@ -131,10 +131,16 @@ void AutomatedRssDownloader::loadFeedList() @@ -131,10 +131,16 @@ void AutomatedRssDownloader::loadFeedList()
const RssSettings settings;
const QStringList feed_aliases = settings.getRssFeedsAliases();
const QStringList feed_urls = settings.getRssFeedsUrls();
QStringList existing_urls;
for(int i=0; i<feed_aliases.size(); ++i) {
QString feed_url = feed_urls.at(i);
feed_url = feed_url.split("\\").last();
qDebug() << Q_FUNC_INFO << feed_url;
if(existing_urls.contains(feed_url)) continue;
QListWidgetItem *item = new QListWidgetItem(feed_aliases.at(i), ui->listFeeds);
item->setData(Qt::UserRole, feed_urls.at(i));
item->setData(Qt::UserRole, feed_url);
item->setFlags(item->flags()|Qt::ItemIsUserCheckable);
existing_urls << feed_url;
}
}
@ -443,8 +449,12 @@ void AutomatedRssDownloader::updateMatchingArticles() @@ -443,8 +449,12 @@ void AutomatedRssDownloader::updateMatchingArticles()
RssDownloadRule rule = m_ruleList->getRule(rule_item->text());
if(!rule.isValid()) continue;
foreach(const QString &feed_url, rule.rssFeeds()) {
qDebug() << Q_FUNC_INFO << feed_url;
Q_ASSERT(all_feeds.contains(feed_url));
if(!all_feeds.contains(feed_url)) continue;
const RssFeed *feed = all_feeds.value(feed_url);
Q_ASSERT(feed);
if(!feed) continue;
const QStringList matching_articles = rule.findMatchingArticles(feed);
if(!matching_articles.isEmpty())
addFeedArticlesToTree(feed, matching_articles);

4
src/rss/rssfolder.cpp

@ -268,7 +268,9 @@ QHash<QString, RssFeed*> RssFolder::getAllFeedsAsHash() const { @@ -268,7 +268,9 @@ QHash<QString, RssFeed*> RssFolder::getAllFeedsAsHash() const {
QHash<QString, RssFeed*> ret;
foreach(RssFile *item, this->values()) {
if(item->getType() == RssFile::FEED) {
RssFeed* feed = static_cast<RssFeed*>(item);
RssFeed* feed = dynamic_cast<RssFeed*>(item);
Q_ASSERT(feed);
qDebug() << Q_FUNC_INFO << feed->getUrl();
ret[feed->getUrl()] = feed;
} else {
ret.unite(static_cast<RssFolder*>(item)->getAllFeedsAsHash());

Loading…
Cancel
Save