diff options
author | Unknwon <u@gogs.io> | 2018-03-08 07:22:14 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-03-08 07:22:14 -0500 |
commit | 63eaac67a64c77c8a17b429647a3599b84f5e66a (patch) | |
tree | 26963c3597874bbe3b73719fe558578a28e5161e /routes | |
parent | 1f7983059aa80307a86c19088decaedfeb019755 (diff) |
repo: improve error handling for PR #4803
Diffstat (limited to 'routes')
-rw-r--r-- | routes/repo/issue.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/routes/repo/issue.go b/routes/repo/issue.go index 29fab3af..41d0df1f 100644 --- a/routes/repo/issue.go +++ b/routes/repo/issue.go @@ -644,9 +644,15 @@ func viewIssue(c *context.Context, isPullList bool) { pull := issue.PullRequest branchProtected := false protectBranch, err := models.GetProtectBranchOfRepoByName(pull.BaseRepoID, pull.HeadBranch) - if err == nil { + if err != nil { + if !errors.IsErrBranchNotExist(err) { + c.ServerError("GetProtectBranchOfRepoByName", err) + return + } + } else { branchProtected = protectBranch.Protected } + c.Data["IsPullBranchDeletable"] = pull.BaseRepoID == pull.HeadRepoID && c.Repo.IsWriter() && c.Repo.GitRepo.IsBranchExist(pull.HeadBranch) && !branchProtected |