diff --git a/pkg/models/project_duplicate.go b/pkg/models/project_duplicate.go index dbc38d2af..0ee15f8a1 100644 --- a/pkg/models/project_duplicate.go +++ b/pkg/models/project_duplicate.go @@ -226,9 +226,11 @@ func duplicateViews(s *xorm.Session, pd *ProjectDuplicate, doer web.Auth, taskMa }) } - _, err = s.Insert(&taskBuckets) - if err != nil { - return err + if len(taskBuckets) > 0 { + _, err = s.Insert(&taskBuckets) + if err != nil { + return err + } } oldTaskPositions := []*TaskPosition{} @@ -246,7 +248,9 @@ func duplicateViews(s *xorm.Session, pd *ProjectDuplicate, doer web.Auth, taskMa }) } - _, err = s.Insert(&taskPositions) + if len(taskPositions) > 0 { + _, err = s.Insert(&taskPositions) + } return }