From 5cc4927b9ef97667bf763772beb36225fdbeded8 Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 7 Jul 2022 23:23:15 +0200 Subject: [PATCH] fix: add missing error check --- pkg/models/tasks.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/models/tasks.go b/pkg/models/tasks.go index 397b0dd5..dbaf59c3 100644 --- a/pkg/models/tasks.go +++ b/pkg/models/tasks.go @@ -17,7 +17,6 @@ package models import ( - "github.com/jinzhu/copier" "math" "regexp" "sort" @@ -25,6 +24,8 @@ import ( "strings" "time" + "github.com/jinzhu/copier" + "code.vikunja.io/api/pkg/config" "code.vikunja.io/api/pkg/db" "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 // and would thus fail with an error. 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 taskMap[rt.TaskID].RelatedTasks[rt.RelationKind] = append(taskMap[rt.TaskID].RelatedTasks[rt.RelationKind], otherTask) }