diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 2b1991f262d82..1a17afeef34d6 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1150,8 +1150,8 @@ func NewIssuePost(ctx *context.Context) { } log.Trace("Issue created: %d/%d", repo.ID, issue.ID) - if ctx.FormString("redirect_after_creation") == "project" { - ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + strconv.FormatInt(form.ProjectID, 10)) + if ctx.FormString("redirect_after_creation") == "project" && projectID > 0 { + ctx.Redirect(ctx.Repo.RepoLink + "/projects/" + strconv.FormatInt(projectID, 10)) } else { ctx.Redirect(issue.Link()) }