summaryrefslogtreecommitdiffstats
path: root/modules/test/context_tests.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/test/context_tests.go')
-rw-r--r--modules/test/context_tests.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/test/context_tests.go b/modules/test/context_tests.go
index cf9c5fbc54..f9f0ec5d42 100644
--- a/modules/test/context_tests.go
+++ b/modules/test/context_tests.go
@@ -58,8 +58,11 @@ func LoadRepoCommit(t *testing.T, ctx *context.Context) {
defer gitRepo.Close()
branch, err := gitRepo.GetHEADBranch()
assert.NoError(t, err)
- ctx.Repo.Commit, err = gitRepo.GetBranchCommit(branch.Name)
- assert.NoError(t, err)
+ assert.NotNil(t, branch)
+ if branch != nil {
+ ctx.Repo.Commit, err = gitRepo.GetBranchCommit(branch.Name)
+ assert.NoError(t, err)
+ }
}
// LoadUser load a user into a test context.