aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLunny Xiao2019-06-10 23:29:07 +0800
committerGitHub2019-06-10 23:29:07 +0800
commit10effb396a94fabab9a1e4a7d8ef1d777d45ee1d (patch)
tree64ecb5a159c1426bf724cc8a5972e1d16b0058d1
parent5e97b2d00ea549f9b9a759eeeb7f19cabc1949fb (diff)
if milestone id is zero don't get it from database (#7174)
-rw-r--r--routers/repo/issue.go14
1 files 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)