Fix crash on adding/removing feeds

This commit is contained in:
Jaidyn Ann 2021-10-20 21:31:42 -05:00
parent 1d8433f598
commit 38584415b2
5 changed files with 16 additions and 3 deletions

View File

@ -146,8 +146,11 @@ FeedEditWindow::_SaveFeed()
fFeed->SetTitle(title.String());
fFeed->SetUrl(BUrl(urlString));
if (BString(fFeed->Identifier()).IsEmpty() == true)
if (BString(fFeed->Identifier()).IsEmpty() == true) {
Source* source = SourceManager::GetSourceOfType("RssAtom");
fFeed->SetSource(source->Config());
SourceManager::AddFeed(fFeed);
}
else
SourceManager::EditFeed(fFeed);

View File

@ -43,6 +43,7 @@ public:
virtual const char* Type() { return "Source"; };
virtual const char* Name() { return "Generic"; };
virtual const char* Config() { return NULL; };
BString fConfigPath;
};

View File

@ -141,7 +141,7 @@ SourceManager::EditFeed(Feed* updated)
void
SourceManager::RemoveFeed(Feed* mortonta)
{
return GetSource(mortonta)->EditFeed(mortonta);
return GetSource(mortonta)->RemoveFeed(mortonta);
}

View File

@ -44,6 +44,13 @@ RssAtom::Name()
}
const char*
RssAtom::Config()
{
return fConfigPath.String();
}
BObjectList<Feed>
RssAtom::Feeds()
{

View File

@ -20,6 +20,7 @@ public:
const char* Type();
const char* Name();
const char* Config();
BObjectList<Feed> Feeds();
@ -34,6 +35,8 @@ public:
bool IsUpdated(Feed* feed);
BString fConfigPath;
private:
bool _IsAtom(Feed* feed);
bool _IsRss(Feed* feed);
@ -71,7 +74,6 @@ private:
BPath _SubscriptionPath();
BString fTitle;
BString fConfigPath;
};