Fixes a crash with preferences, as well as fixes a bug where a
non-existing item can be added to the list even though it exists in the users preferences. Moved a script function retrieval into a try/catch block. Fixed a file list bug, needed to make a copy and clear; also if a crash happened the list would never be cleared, and a script could get stuck on one file. Scripts should have their own try/catch around each individual file if they want to continue processing files without interruption.
This commit is contained in:
parent
09124edc2b
commit
a6c6f34080
5 changed files with 24 additions and 10 deletions
|
@ -137,6 +137,8 @@ namespace FileWatcher
|
|||
}
|
||||
}
|
||||
|
||||
defaultPrograms.RemoveAll(str => !programs.ContainsKey(str) || !File.Exists(programs[str].Path));
|
||||
|
||||
UnboundBindingList = new BindingList<string>(defaultPrograms);
|
||||
foreach (string str in programs.Keys)
|
||||
{
|
||||
|
@ -210,8 +212,12 @@ namespace FileWatcher
|
|||
{
|
||||
if (listBox1.SelectedValue != null)
|
||||
{
|
||||
string path = programs[(string)listBox1.SelectedValue].Path;
|
||||
textBox1.Text = path;
|
||||
string selectedValue = (string)listBox1.SelectedValue;
|
||||
if (programs.ContainsKey(selectedValue))
|
||||
{
|
||||
string path = programs[(string)listBox1.SelectedValue].Path;
|
||||
textBox1.Text = path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue