Skip to content

Commit 0a06837

Browse files
committed
fix old commit nil panic
1 parent c54bc3f commit 0a06837

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

routers/api/v1/repo/branch.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ func CreateBranch(ctx *context.APIContext) {
189189
ctx.Error(http.StatusInternalServerError, "GetBranchCommit", err)
190190
return
191191
}
192+
} else {
193+
ctx.Error(http.StatusNotFound, "", "The old branch does not exist")
194+
return
192195
}
193196
} else {
194197
oldCommit, err = ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)

0 commit comments

Comments
 (0)