]> source.dussan.org Git - gitea.git/commitdiff
Fix the nil pointer when assigning issues to projects (#25665)
authorZettat123 <zettat123@gmail.com>
Tue, 4 Jul 2023 10:26:24 +0000 (18:26 +0800)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 10:26:24 +0000 (10:26 +0000)
Fixes #25649
Caused by #25468

routers/web/org/projects.go
routers/web/repo/projects.go

index e525f2c43f3ac956fc562f5a55909454635ce7e7..c568b1c07164cbb61bef09942cff59ca2967c12c 100644 (file)
@@ -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 {
index 6da9edfd0b802faee26f66f619191f92d8cfe2b3..b1033fe0030e97288112aa2564cf21675ecfffdf 100644 (file)
@@ -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 {