Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit 6e16d43

Browse files
committed
[Core] Fixes #339. Unittests may have a null ExecutableDirectory property, so guard against this
1 parent cd53615 commit 6e16d43

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Bam.Core/BamState.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,17 @@ private static string
113113
private string
114114
GetNuGetDirectory()
115115
{
116-
var rootDir = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(this.ExecutableDirectory));
117-
var nugetDir = System.IO.Path.Combine(rootDir, "NuGetPackages");
118-
return nugetDir;
116+
try
117+
{
118+
var rootDir = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(this.ExecutableDirectory));
119+
var nugetDir = System.IO.Path.Combine(rootDir, "NuGetPackages");
120+
return nugetDir;
121+
}
122+
catch (System.ArgumentNullException)
123+
{
124+
// may occur during unittests
125+
return null;
126+
}
119127
}
120128

121129
/// <summary>

0 commit comments

Comments
 (0)