From 037022e8570f9b7b0d3053e2b20057b8f5630803 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sat, 6 Apr 2024 13:55:11 +0200 Subject: [PATCH] fix: do not try to fetch nonexistant bucket --- pkg/migration/20240406125227.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/migration/20240406125227.go b/pkg/migration/20240406125227.go index 0bc145bb6..d20ebd4a9 100644 --- a/pkg/migration/20240406125227.go +++ b/pkg/migration/20240406125227.go @@ -17,6 +17,7 @@ package migration import ( + "code.vikunja.io/api/pkg/log" "src.techknowlogick.com/xormigrate" "xorm.io/xorm" ) @@ -64,7 +65,12 @@ func init() { } for _, tb := range tbs { - tb.ProjectViewID = buckets[tb.BucketID].ProjectViewID + bucket, exists := buckets[tb.BucketID] + if !exists { + log.Debugf("Bucket %d does not exist but has task_buckets relation", tb.BucketID) + continue + } + tb.ProjectViewID = bucket.ProjectViewID _, err = tx. Where("task_id = ? AND bucket_id = ?", tb.TaskID, tb.BucketID). Cols("project_view_id").