From 10effb396a94fabab9a1e4a7d8ef1d777d45ee1d Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 10 Jun 2019 23:29:07 +0800 Subject: [PATCH] if milestone id is zero don't get it from database (#7174) --- routers/repo/issue.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index e1c92b216..c537cba7d 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -406,12 +406,14 @@ func NewIssue(ctx *context.Context) { ctx.Data["BodyQuery"] = body milestoneID := ctx.QueryInt64("milestone") - milestone, err := models.GetMilestoneByID(milestoneID) - if err != nil { - log.Error(4, "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(4, "GetMilestoneByID: %d: %v", milestoneID, err) + } else { + ctx.Data["milestone_id"] = milestoneID + ctx.Data["Milestone"] = milestone + } } setTemplateIfExists(ctx, issueTemplateKey, IssueTemplateCandidates)