Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 8b4c262

Browse files
committed
Fix NullReferenceException in Git.FindGit if PATH is not set.
1 parent a56a10c commit 8b4c262

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • src/AddIns/VersionControl/GitAddIn/Src

src/AddIns/VersionControl/GitAddIn/Src/Git.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public static Task<int> RunGitAsync(string workingDir, params string[] arguments
9494
/// </summary>
9595
public static string FindGit()
9696
{
97-
string[] paths = Environment.GetEnvironmentVariable("PATH").Split(';');
97+
string pathVariable = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
98+
string[] paths = pathVariable.Split(new char[]{';'}, StringSplitOptions.RemoveEmptyEntries);
9899
foreach (string path in paths) {
99100
try {
100101
string exe = Path.Combine(path, "git.exe");

0 commit comments

Comments
 (0)