Skip to content

Commit

Permalink
LFO Preset Crashing Bug (#6919)
Browse files Browse the repository at this point in the history
a .modpreset in the top (without parent folder) of the mod
presets directory would recurse forever crashing. Make them
appear in the right spot with a couple of path.empty() checks
  • Loading branch information
baconpaul authored Apr 8, 2023
1 parent d42d582 commit fc85ef3
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3125,23 +3125,36 @@ juce::PopupMenu SurgeGUIEditor::makeLfoMenu(const juce::Point<int> &where)
m.addItem(p.name, action);
}
bool haveD = false;
for (const auto &sc : presetCategories)
if (cat.path.empty())
{
if (sc.parentPath == cat.path)
// This is a preset in the root
}
else
{
for (const auto &sc : presetCategories)
{
if (!haveD)
m.addSeparator();
haveD = true;
juce::PopupMenu subMenu;
recurseCat(subMenu, sc);
m.addSubMenu(sc.name, subMenu);
if (sc.parentPath == cat.path)
{
if (!haveD)
m.addSeparator();
haveD = true;
juce::PopupMenu subMenu;
recurseCat(subMenu, sc);
m.addSubMenu(sc.name, subMenu);
}
}
}
};

for (auto tlc : presetCategories)
{
if (tlc.parentPath.empty())
if (tlc.path.empty())
{
// We have presets in the root! Don't recurse forever and put them in the root
recurseCat(lfoSubMenu, tlc);
lfoSubMenu.addSeparator();
}
else if (tlc.parentPath.empty())
{
juce::PopupMenu sm;
recurseCat(sm, tlc);
Expand Down

0 comments on commit fc85ef3

Please sign in to comment.