Skip to content

Commit

Permalink
Fix potential crash when deleting files from recently opened
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Dec 11, 2024
1 parent b53eb6f commit 79cfce0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Source/Components/WelcomePanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,20 +820,24 @@ class WelcomePanel : public Component
}

if (recentlyOpenedTree.isValid()) {
// Place favourited patches at the top
for (int i = 0; i < recentlyOpenedTree.getNumChildren(); i++) {

for (int i = recentlyOpenedTree.getNumChildren() - 1; i >= 0 ; i--) {
auto subTree = recentlyOpenedTree.getChild(i);
auto patchFile = File(subTree.getProperty("Path").toString());

if(!File(patchFile).existsAsFile())
{
if(!subTree.hasProperty("Removable"))
{
recentlyOpenedTree.removeChild(subTree, nullptr);
recentlyOpenedTree.removeChild(i, nullptr);

}
continue;
}
}

// Place favourited patches at the top
for (int i = 0; i < recentlyOpenedTree.getNumChildren(); i++) {

auto subTree = recentlyOpenedTree.getChild(i);
auto patchFile = File(subTree.getProperty("Path").toString());

auto patchThumbnailBase = File(patchFile.getParentDirectory().getFullPathName() + "\\" + patchFile.getFileNameWithoutExtension() + "_thumb");

Expand Down

0 comments on commit 79cfce0

Please sign in to comment.