From 75fbd0a2ca924482c81e65279c76cf9a7506626c Mon Sep 17 00:00:00 2001 From: sr55 Date: Sun, 16 Apr 2017 10:59:40 +0100 Subject: WinGui: Fix a possible exception when cancelling and rescanning a source that would cause it to never complete the second time. Fixes #671 --- win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'win/CS/HandBrakeWPF') diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 9bb991efc..0c4637e6f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -2336,8 +2336,12 @@ namespace HandBrakeWPF.ViewModels /// private void ScanCompleted(object sender, ScanCompletedEventArgs e) { - if (e.ScannedSource != null) + if (e.ScannedSource != null && !e.Cancelled) { + if (this.ScannedSource == null) + { + this.ScannedSource = new Source(); + } e.ScannedSource.CopyTo(this.ScannedSource); } else -- cgit v1.2.3