Skip to content

Commit

Permalink
Fixed #74
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletGiraffe committed Mar 17, 2014
1 parent f929545 commit b7648f3
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions CPPCheckPlugin/CPPCheckPluginPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,16 @@ private void documentSaved(Document document)
{
return;
}
var currentConfig = document.ProjectItem.ConfigurationManager.ActiveConfiguration;

Configuration currentConfig = null;
try { currentConfig = document.ProjectItem.ConfigurationManager.ActiveConfiguration; }
catch (Exception) { currentConfig = null; }
if (currentConfig == null)
{
MessageBox.Show("Cannot perform check - no valid configuration selected", "Cppcheck error");
return;
}

SourceFile sourceForAnalysis = createSourceFile(document.FullName, currentConfig, project);
if (sourceForAnalysis == null)
return;
Expand Down Expand Up @@ -266,7 +275,13 @@ private void checkCurrentProject()
System.Windows.MessageBox.Show("Only C++ projects can be checked.");
return;
}
currentConfig = ((Project)o).ConfigurationManager.ActiveConfiguration;
try { currentConfig = ((Project)o).ConfigurationManager.ActiveConfiguration; }
catch (Exception) { currentConfig = null; }
if (currentConfig == null)
{
MessageBox.Show("Cannot perform check - no valid configuration selected", "Cppcheck error");
return;
}
dynamic projectFiles = project.Files;
foreach (dynamic file in projectFiles)
{
Expand Down

0 comments on commit b7648f3

Please sign in to comment.