Ignore errors in update recent files for missing files

This commit is contained in:
Nikolaj Olsson 2020-10-13 19:54:06 +02:00
parent 6983acaefa
commit ae09489ac4

View File

@ -3540,16 +3540,23 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
Configuration.Settings.RecentFiles.Files = Configuration.Settings.RecentFiles.Files try
.Where(p => !notExistingFiles.Contains(p.FileName)).ToList();
for (var index = reopenToolStripMenuItem.DropDownItems.Count - 1; index >= 0; index--)
{ {
ToolStripItem item = reopenToolStripMenuItem.DropDownItems[index]; Configuration.Settings.RecentFiles.Files = Configuration.Settings.RecentFiles.Files
if (notExistingFiles.Contains((string)item.Tag)) .Where(p => !notExistingFiles.Contains(p.FileName)).ToList();
for (var index = reopenToolStripMenuItem.DropDownItems.Count - 1; index >= 0; index--)
{ {
reopenToolStripMenuItem.DropDownItems.RemoveAt(index); ToolStripItem item = reopenToolStripMenuItem.DropDownItems[index];
if (notExistingFiles.Contains((string)item.Tag))
{
reopenToolStripMenuItem.DropDownItems.RemoveAt(index);
}
} }
} }
catch
{
// ignore
}
}; };
bw.RunWorkerAsync(Configuration.Settings.RecentFiles.Files); bw.RunWorkerAsync(Configuration.Settings.RecentFiles.Files);
} }