summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/Views
diff options
context:
space:
mode:
authorsr55 <[email protected]>2012-11-27 16:32:13 +0000
committersr55 <[email protected]>2012-11-27 16:32:13 +0000
commitf93ce617afdba769738f8be17e3f80391231b822 (patch)
treec5a73207ada9cba874c5f36d16bb534f3cf3fa44 /win/CS/HandBrakeWPF/Views
parent2c09426fd20474250645429d4526c1191f6a8cf4 (diff)
WinGui: General code tidy-up and fix a couple of possible points that could throw exceptions.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5083 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Views')
-rw-r--r--win/CS/HandBrakeWPF/Views/ShellView.xaml.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
index 77b0d858c..8a086ea09 100644
--- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs
@@ -60,10 +60,15 @@ namespace HandBrakeWPF.Views
/// </param>
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
- bool canClose = ((IShellViewModel)this.DataContext).CanClose();
- if (!canClose)
+ IShellViewModel shellViewModel = this.DataContext as IShellViewModel;
+
+ if (shellViewModel != null)
{
- e.Cancel = true;
+ bool canClose = shellViewModel.CanClose();
+ if (!canClose)
+ {
+ e.Cancel = true;
+ }
}
base.OnClosing(e);