Skip to content

Commit 7c17eb8

Browse files
committed
Added null-guard on branch in FindCommitBranchWasBranchedFrom().
1 parent 0d87102 commit 7c17eb8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/GitVersionCore/LibGitExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ namespace GitVersion
66
using System.Linq;
77
using System.Text;
88
using GitVersion.Helpers;
9+
10+
using JetBrains.Annotations;
11+
912
using LibGit2Sharp;
1013

1114
static class LibGitExtensions
@@ -44,8 +47,14 @@ public static SemanticVersion LastVersionTagOnBranch(this Branch branch, IReposi
4447
.FirstOrDefault();
4548
}
4649

47-
public static Commit FindCommitBranchWasBranchedFrom(this Branch branch, IRepository repository, params Branch[] excludedBranches)
50+
51+
public static Commit FindCommitBranchWasBranchedFrom([NotNull] this Branch branch, IRepository repository, params Branch[] excludedBranches)
4852
{
53+
if (branch == null)
54+
{
55+
throw new ArgumentNullException("branch");
56+
}
57+
4958
using (Logger.IndentLog("Finding branch source"))
5059
{
5160
var otherBranches = repository.Branches.Except(excludedBranches).Where(b => IsSameBranch(branch, b)).ToList();

0 commit comments

Comments
 (0)