diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-06-10 22:16:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-10 22:16:02 +0800 |
commit | 7162fbf3d6adf0a1f5b7ce95df5603d995b35d85 (patch) | |
tree | 238b9d74890365237cb491be3065f032ad18d749 /routers | |
parent | d93e6232e829a1ade1f9540a701061967aa7d61d (diff) | |
download | gitea-7162fbf3d6adf0a1f5b7ce95df5603d995b35d85.tar.gz gitea-7162fbf3d6adf0a1f5b7ce95df5603d995b35d85.zip |
if milestone id is zero don't get it from database (#7169)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/issue.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go index f6030c9823..cd384da0d6 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -426,12 +426,14 @@ func NewIssue(ctx *context.Context) { ctx.Data["BodyQuery"] = body milestoneID := ctx.QueryInt64("milestone") - milestone, err := models.GetMilestoneByID(milestoneID) - if err != nil { - log.Error("GetMilestoneByID: %d: %v", milestoneID, err) - } else { - ctx.Data["milestone_id"] = milestoneID - ctx.Data["Milestone"] = milestone + if milestoneID > 0 { + milestone, err := models.GetMilestoneByID(milestoneID) + if err != nil { + log.Error("GetMilestoneByID: %d: %v", milestoneID, err) + } else { + ctx.Data["milestone_id"] = milestoneID + ctx.Data["Milestone"] = milestone + } } setTemplateIfExists(ctx, issueTemplateKey, IssueTemplateCandidates) |