Fix the nil pointer when assigning issues to projects (#25665) (#25677)

Backport #25665 by @Zettat123

Fixes #25649
Caused by #25468

Co-authored-by: Zettat123 <zettat123@gmail.com>
pull/25668/head^2
Giteabot 2 years ago committed by GitHub
parent 39fce5750d
commit 5510ed34f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      routers/web/org/projects.go
  2. 8
      routers/web/repo/projects.go

@ -436,9 +436,11 @@ func UpdateIssueProject(ctx *context.Context) {
projectID := ctx.FormInt64("id")
for _, issue := range issues {
oldProjectID := issue.Project.ID
if oldProjectID == projectID {
continue
if issue.Project != nil {
oldProjectID := issue.Project.ID
if oldProjectID == projectID {
continue
}
}
if err := issues_model.ChangeProjectAssign(issue, ctx.Doer, projectID); err != nil {

@ -385,9 +385,11 @@ func UpdateIssueProject(ctx *context.Context) {
projectID := ctx.FormInt64("id")
for _, issue := range issues {
oldProjectID := issue.Project.ID
if oldProjectID == projectID {
continue
if issue.Project != nil {
oldProjectID := issue.Project.ID
if oldProjectID == projectID {
continue
}
}
if err := issues_model.ChangeProjectAssign(issue, ctx.Doer, projectID); err != nil {

Loading…
Cancel
Save