diff --git a/routers/web/org/projects.go b/routers/web/org/projects.go index e525f2c43f3ac..c568b1c07164c 100644 --- a/routers/web/org/projects.go +++ b/routers/web/org/projects.go @@ -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 { diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index 6da9edfd0b802..b1033fe0030e9 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -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 {