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
go-gitea#25677)

Backport go-gitea#25665 by @Zettat123

Fixes go-gitea#25649
Caused by go-gitea#25468

Co-authored-by: Zettat123 <[email protected]>
  • Loading branch information
GiteaBot and Zettat123 authored Jul 4, 2023
1 parent 39fce57 commit 5510ed3
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 5510ed3

Please sign in to comment.