forked from gitea/gitea
1
0
Fork 0

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>
This commit is contained in:
Giteabot 2023-07-04 06:59:01 -04:00 committed by GitHub
parent 39fce5750d
commit 5510ed34f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

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

View File

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