diff options
author | Matt Ward <matt.ward@xamarin.com> | 2017-05-30 17:26:13 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@xamarin.com> | 2017-05-30 17:26:13 +0300 |
commit | 78005ef18fb803207ab04e38f35ff9701ae57b75 (patch) | |
tree | 1200091916a2325f27cee760fb4f87821058d3a1 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools | |
parent | dc447c65582293421a439923b8c69ac1835db668 (diff) |
[Ide] Allow CustomToolService to be used in unit tests
If the IdeApp.Workspace is not initialized by the tests then a null
reference is thrown by the CustomToolService if it is used.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs index a0a37d81a4..a4a2ca67f8 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs @@ -69,6 +69,11 @@ namespace MonoDevelop.Ide.CustomTools break; } }); + + // Allow CustomToolService to be used when running unit tests that do not initialize the workspace. + if (IdeApp.Workspace == null) + return; + IdeApp.Workspace.FileChangedInProject += delegate (object sender, ProjectFileEventArgs args) { foreach (ProjectFileEventInfo e in args) Update (e.ProjectFile, e.Project, false); |