fix: add missing error check

This commit is contained in:
kolaente 2022-07-07 23:23:15 +02:00
parent 2b074c60a7
commit 5cc4927b9e
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -17,7 +17,6 @@
package models package models
import ( import (
"github.com/jinzhu/copier"
"math" "math"
"regexp" "regexp"
"sort" "sort"
@ -25,6 +24,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/jinzhu/copier"
"code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/config"
"code.vikunja.io/api/pkg/db" "code.vikunja.io/api/pkg/db"
"code.vikunja.io/api/pkg/events" "code.vikunja.io/api/pkg/events"
@ -681,7 +682,11 @@ func addRelatedTasksToTasks(s *xorm.Session, taskIDs []int64, taskMap map[int64]
// We're duplicating the other task to avoid cycles as these can't be represented properly in json // We're duplicating the other task to avoid cycles as these can't be represented properly in json
// and would thus fail with an error. // and would thus fail with an error.
otherTask := &Task{} otherTask := &Task{}
copier.Copy(otherTask, fullRelatedTasks[rt.OtherTaskID]) err = copier.Copy(otherTask, fullRelatedTasks[rt.OtherTaskID])
if err != nil {
log.Errorf("Could not duplicate task object: %v", err)
continue
}
otherTask.RelatedTasks = nil otherTask.RelatedTasks = nil
taskMap[rt.TaskID].RelatedTasks[rt.RelationKind] = append(taskMap[rt.TaskID].RelatedTasks[rt.RelationKind], otherTask) taskMap[rt.TaskID].RelatedTasks[rt.RelationKind] = append(taskMap[rt.TaskID].RelatedTasks[rt.RelationKind], otherTask)
} }