Skip to content

Commit

Permalink
Fix the nil pointer when assigning issues to projects (go-gitea#25665)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zettat123 authored and GiteaBot committed Jul 4, 2023
1 parent 39fce57 commit 6243432
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions routers/web/org/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 5 additions & 3 deletions routers/web/repo/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6243432

Please sign in to comment.