Skip to content

Commit

Permalink
Catch corrupted queue items on startup #154
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Jan 21, 2024
1 parent 1be1171 commit 9b305bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion NotEnoughAV1Encodes/MainWindow.xaml.cs
Expand Up @@ -123,7 +123,15 @@ private void Initialize()

foreach (string file in filePaths)
{
ListBoxQueue.Items.Add(JsonConvert.DeserializeObject<Queue.QueueElement>(File.ReadAllText(file)));
try
{
var deserialized = JsonConvert.DeserializeObject<Queue.QueueElement>(File.ReadAllText(file));
ListBoxQueue.Items.Add(deserialized);
}
catch (Exception ex)
{
MessageBox.Show("Queue File " + file + " is corrupted. \n\nMessage from JSON parser: \n" + ex.Message + "\n\nPlease report this at Github!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}

Expand Down

0 comments on commit 9b305bb

Please sign in to comment.