Skip to content

Commit 5510ed3

Browse files
GiteaBotZettat123
andauthored
Fix the nil pointer when assigning issues to projects (#25665) (#25677)
Backport #25665 by @Zettat123 Fixes #25649 Caused by #25468 Co-authored-by: Zettat123 <[email protected]>
1 parent 39fce57 commit 5510ed3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

routers/web/org/projects.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,11 @@ func UpdateIssueProject(ctx *context.Context) {
436436

437437
projectID := ctx.FormInt64("id")
438438
for _, issue := range issues {
439-
oldProjectID := issue.Project.ID
440-
if oldProjectID == projectID {
441-
continue
439+
if issue.Project != nil {
440+
oldProjectID := issue.Project.ID
441+
if oldProjectID == projectID {
442+
continue
443+
}
442444
}
443445

444446
if err := issues_model.ChangeProjectAssign(issue, ctx.Doer, projectID); err != nil {

routers/web/repo/projects.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,11 @@ func UpdateIssueProject(ctx *context.Context) {
385385

386386
projectID := ctx.FormInt64("id")
387387
for _, issue := range issues {
388-
oldProjectID := issue.Project.ID
389-
if oldProjectID == projectID {
390-
continue
388+
if issue.Project != nil {
389+
oldProjectID := issue.Project.ID
390+
if oldProjectID == projectID {
391+
continue
392+
}
391393
}
392394

393395
if err := issues_model.ChangeProjectAssign(issue, ctx.Doer, projectID); err != nil {

0 commit comments

Comments
 (0)