Skip to content

Commit 446736f

Browse files
committed
Fixed crash when loading if project no longer exists
1 parent dc71aa8 commit 446736f

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

Insight/MainViewModel.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Diagnostics;
55
using System.IO;
66
using System.Linq;
7-
using System.Runtime.Versioning;
7+
using System.Windows;
88
using System.Windows.Input;
99

1010
using Insight.Alias;
@@ -125,16 +125,26 @@ private void InvalidateActiveAnalysis()
125125

126126
private void SetActiveProject(Project project)
127127
{
128+
128129
InvalidateActiveAnalysis();
129130

130-
_project = project;
131-
if (_project != null && !_project.IsDefault)
131+
try
132132
{
133-
ConfigureAnalyzer();
133+
_project = project;
134+
if (_project != null && !_project.IsDefault)
135+
{
136+
ConfigureAnalyzer();
137+
}
134138
}
135-
139+
catch (Exception ex)
140+
{
141+
InvalidateActiveAnalysis();
142+
MessageBox.Show("Failed setting active project: " + ex.Message);
143+
}
144+
136145
// Update Ribbon
137146
Refresh();
147+
138148
}
139149

140150
/// <summary>

0 commit comments

Comments
 (0)