Skip to content

Commit

Permalink
Handle a crash case with corrupted favorites file (#174)
Browse files Browse the repository at this point in the history
If the favorites file didn't parse I tried to read the parse
result anyway, leading to a crash on startup
  • Loading branch information
baconpaul authored Dec 19, 2024
1 parent a5d9c06 commit 7b4844f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src-juce/AWConsolidatedEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,13 @@ void AWConsolidatedAudioProcessorEditor::unstreamFavorites()
{
auto xd = juce::XmlDocument(ff);
auto re = xd.getDocumentElement();

if (!re)
{
std::cerr << "Favorites file is corrupted: " << xd.getLastParseError() << std::endl;
return;
}

for (auto *e : re->getChildIterator())
{
auto fn = e->getStringAttribute("fx");
Expand Down

0 comments on commit 7b4844f

Please sign in to comment.